<template>
<!-- 报销单 -->
<section class="content-box">
	<div v-if="isshowList">
		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-form class="title cover">
				<h2>报销单</h2>
				<el-form-item>
					<el-button size="small" class="el-icon-plus" @click="handleAdd">&nbsp;新建&nbsp;</el-button>
				</el-form-item>
        <el-form-item>
          <el-button size="small" @click="search" class="el-icon-search">&nbsp;查询</el-button>
        </el-form-item>
			</el-form>
		</el-col>
		<!-- 列表 -->
		<!-- <el-table class="indexList" v-if="ExpenseList" :data="ExpenseList" highlight-current-row v-loading="loading" element-loading-text="正在加载中">
			<el-table-column label="序号" type="index" width="100" sortable>
      </el-table-column>
      <el-table-column prop="Expense_CreateDate" label="日期" :formatter="formatDate" sortable>
			</el-table-column>
			<el-table-column prop="Expense_DocNO" label="编号" sortable>
			</el-table-column>
			<el-table-column prop="Expense_Title" label="标题"  show-overflow-tooltip>
			</el-table-column>
			<el-table-column prop="UserName" label="申请人">
			</el-table-column>
			<el-table-column prop="Expense_TotalRequestMoney" label="总金额" sortable>
			</el-table-column>
			<el-table-column prop="DocStatus" label="状态" sortable>
			</el-table-column>
			<el-table-column label="操作" min-width="150">
				<template slot-scope="scope">
          <el-button-group>
						<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
						<el-button size="small" v-if="scope.row.DocStatus==='待审核'"  @click="repeal(scope.$index, scope.row)">撤销</el-button>
						<el-button size="small" @click.native="checkflowRow(scope.$index, scope.row)">查看流程</el-button>
						<el-button size="small" @click.native="handleDel(scope.$index, scope.row)">删除</el-button>
            <el-button size="small" v-if="scope.row.AttachmentCount>0" class="icon iconfont icon-attachment"></el-button>
          </el-button-group>
        </template>
			</el-table-column>
		</el-table> -->
    <!-- wuhongqing -->
    <el-table class="indexList" @cell-mouse-enter="cellMouseEnterTwoFn" @cell-mouse-leave="cellMouseLeaveFn" v-if="ExpenseList" @row-dblclick="handleEdit" :data="ExpenseList" highlight-current-row v-loading="loading" element-loading-text="正在加载中" style="width: 100%;">
      <el-table-column prop="Expense_CreateDate" label="日期" :formatter="formatDate" sortable>
			</el-table-column>
			<el-table-column prop="Expense_DocNO" label="单号" sortable>
			</el-table-column>
			<el-table-column prop="Expense_TotalRequestMoney" label="金额" sortable>
			</el-table-column>
			<el-table-column prop="Expense_Title" label="业务描述" min-width="150"  show-overflow-tooltip>
			</el-table-column>
			<el-table-column prop="DocStatus" label="状态" sortable>
			</el-table-column>
			<el-table-column label="操作">
				<template slot-scope="scope">
          <!-- <el-button-group>
						<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
						<el-button size="small" v-if="scope.row.DocStatus==='待审核'"  @click="repeal(scope.$index, scope.row)">撤销</el-button>
						<el-button size="small" @click.native="checkflowRow(scope.$index, scope.row)">查看流程</el-button>
						<el-button size="small" @click.native="handleDel(scope.$index, scope.row)">删除</el-button>
            <el-button size="small" v-if="scope.row.AttachmentCount>0" class="icon iconfont icon-attachment"></el-button>
          </el-button-group> -->
          <div v-if="scope.row.Expense_DocNO==mouse_enter_Borrow_DocNO">
          <!-- <div>  -->
            <div  v-if="scope.row.DocStatus==='待审核'" class="list-img" @click.stop="repeal(scope.$index, scope.row)">
              <!-- 撤销 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-repeal.png" alt=""/>
            </div>
            <div v-if="scope.row.DocStatus!=='新建'" class="list-img" @click.stop="checkflowRow(scope.$index, scope.row)">
              <!-- 查看流程 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-flow.png" alt=""/>
            </div>
            <div v-if="scope.row.DocStatus==='新建'" class="list-img" @click.stop="handleDel(scope.$index, scope.row)">
              <!-- 删除 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-list-dele.png" alt=""/>
            </div>
            <div  v-if="scope.row.AttachmentCount>0" class="list-img">
              <!-- 附件 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-attach.png" alt=""/>
            </div>
          </div>
        </template>
			</el-table-column>
		</el-table>
    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination @current-change="changePage" layout="prev, pager, next" :page-size="rows" :current-page="currentPage" :total="total" style="float:right;">
      </el-pagination>
    </el-col>

    <!--流程图-->
		<el-dialog title="流程执行情况" :visible.sync="checkflowRowVisible" :modal-append-to-body="false" align="center">
			<el-table :data="docRowView" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
				<el-table-column property="PlanUser" label="操作人"></el-table-column>
				<el-table-column property="StepName" label="步骤名称"></el-table-column>
				<el-table-column property="OpDate" label="时间"></el-table-column>
				<el-table-column property="OpRemark" label="备注"></el-table-column>
			</el-table>
		</el-dialog>
	</div>
	<!--新建页面-->
	<div v-if="isshowAdd">
			<!-- 导航条 -->
			<div class="flex-top">
				<div>
					<i class="el-icon-arrow-left back" @click="addToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						报销单 </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">新增</el-tag>
					</small> -->
				</div>
				<!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <el-button-group>
              <el-button size="small" @click="openUploadDialog">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button> 
              <el-button size="small" @click="addSave">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="addSubmit">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
            </el-button-group>
					</span>
				</div>
			</div>
      <div class="flex-content">
        <!-- 中部 -->
        <main class="borrow main">
          <div class="main-left">
            <div v-if="DocNo">
              <h3>单号:</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" placeholder="选择日期" v-model="expense_DocDate">
                </el-date-picker>
              </div>
            </div>
            <div>
              <h3>本次付款金额</h3>
              <div class="comPay-wrapper">
                <strong class="comPay-icon">
                  <i class="icon iconfont icon-yue"></i>
                </strong>
                <!-- <el-input type="number" style="width:100px;" v-model.number="comPay"></el-input> -->
                <div class="comPay-text">
                  <span class="comPay-input">{{comPay}}</span>
                </div>
              </div>
            </div>
          </div>
          <div class="main-right">
            <div class="left-form">
              <el-row>
                <el-col :span="12">
                  <span class="ele-text">收款对方</span>
                  <el-radio-group v-model="supplierRadio" class="ele-form" @change="checkRadio(supplierRadio)">
                    <el-radio :label="2">{{name}}</el-radio>
                    <!-- <el-radio :label="1">其他</el-radio> -->
                    <el-radio :label="1">
                      <div class="supplier-wrapper">
                        <u @click="showDropDial" class="text-ellipsis">{{supplierSelect!=""&&supplierRadio==1?SupplyCodeToNameFn:"其他"}}</u>
                        <!-- <el-popover ref="popover4" placement="bottom" width="320" trigger="click">
                          <div style="height:305px;">
                            <el-select v-model="supplierSelect" class="ele-form" :class="{ 'show-drop': supplierRadio==1 }" @change="choiceSupplie(supplierSelect)" filterable placeholder="请选择供应商">
                              <el-option v-for="(item,index) in selecSupplier" :key="index" :value='item.Code' :label="item.Name">
                              </el-option>
                            </el-select>
                          </div>
                        </el-popover>                
                        <el-button ref="supplierRadioTwo" class="btn-no-border" v-popover:popover4></el-button> -->
                        <div v-show="isShowSupplierSelect" class="supplier-dialog-cover" @click="supplierRadio=2"></div>
                        <div v-show="isShowSupplierSelect" class="supplier-dialog-wrapper">
                          <div class="supplier-dialog-box">
                            <div>
                              <el-select v-model="supplierSelect" class="ele-form" :class="{ 'show-drop': supplierRadio==1 }" @change="choiceSupplie(supplierSelect)" filterable placeholder="请选择供应商">
                                <el-option v-for="(item,index) in selecSupplier" :key="index" :value='item.Code' :label="item.Name">
                                </el-option>
                              </el-select>
                            </div>
                            <i class="kx-arrow kx-arrow-up">
                              <em></em>
                              <span></span>
                            </i>
                          </div>
                        </div>
                      </div>
                    </el-radio>
                  </el-radio-group>
                </el-col>
                <el-col :span="12" style="position:relative">
                  <span class="ele-text">银行账号</span>
                  <span v-if="rcvBank" type="primary" class="bankNum">
                    {{rcvBankAccount}}
                  </span>
                </el-col>
                <el-col :span="12">
                  <span class="text-money">申请金额(含税)元</span>
                  <input type="text" @blur="doToFixedFn('Expense_TotalRequestMoney')" @keyup="onlyNumBasicFn('Expense_TotalRequestMoney')" v-model="Expense_TotalRequestMoney" class='applied'>
                  <!-- <el-input v-model.number="Expense_TotalRequestMoney" class="applied"></el-input> -->
                </el-col>
                <el-col :span="12">
                  <span class="ele-text">开户银行</span>
                  <el-select v-model="rcvBank" class="ele-form" @change="bankChange(rcvBank)">
                    <el-option v-for="(items,index) in bankInfo" :key="index" :value="items.Code" :label="items.Bank">
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="24" class="expense-title-wrapper">
                  <span class="ele-text">业务描述</span>
                  <el-input
                  type="textarea"
                  :rows="3"
                  placeholder="请输入内容"
                  v-model="expense_Title"
                  class="textarea-title">
                  </el-input>
                </el-col>

              </el-row>
            </div>
            <!-- <div class="right-form">
                
            </div> -->
          </div>
        </main>
        <!--底部-->
        <div class="budget-two" ref="budgetBox">
          <div class="nav">
            <div class="inline-block">
              <el-switch 
              v-model="isShowOpera" 
              @change="showChange(isShowOpera)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;核销借款  
            </div>
            <div class="inline-block ml20">
              <el-switch 
              v-model="isShowExpense" 
              @change="showChange(isShowExpense)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;往来明细               
            </div>
            <div class="inline-block ml20" v-if="valAddTaxRight==='True'">
              <el-switch
              :disabled="Type===2||Type===3" 
              v-model="isShowValueAddTax" 
              @change="changeShowValueAddTax(isShowValueAddTax)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;取得增值税专用发票
            </div>            
          </div>
          <!-- 核销借款 -->
          <transition name="fade">
            <div  v-if="isShowOpera">
              <div class="padding-size-10">
                <div class="nav">
                  <span><i class="icon iconfont icon-iconfontcolor52"></i>核销借款</span>
                  <!-- &#x3000;合计：<span class="Count">{{Count1}}</span>   -->
                  <!-- <el-button class="add-button" size="small" @click.native="getOperaAddDiaLog">&nbsp;点击添加&nbsp;</el-button> -->
                </div>
                <el-dialog title="欠款明细" :visible.sync="dialogOperaVisible" @close="doCloseFn" :modal-append-to-body="false" align="center" size="small">
                  <!-- 
                      新增 弹窗 借款单信息
                    -->
                  <el-table :data="operationTemp" border highlight-current-row max-height="300" class="th-text-center">
                    <el-table-column label="借款单" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_DocNO }}
                    </template>
                    </el-table-column>	
                    <el-table-column label="总金额" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
                    </template>
                    </el-table-column>
                    <el-table-column label="未核销金额" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                    </el-table-column>
                    <el-table-column label="本次核销金额" width="140">
                    <template slot-scope="scope">
                      <div class="full-box"><el-input type="text" @keyup.native="onlyNumObjFn(scope,'row','Money')" @blur="doToFixed(scope,'row','Money')" :autofocus="true" v-model="scope.row.Money" placeholder="请输入金额">
                      </el-input></div>
                    </template>
                    </el-table-column>
                    <el-table-column label="事由">
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_Title }}
                    </template>
                    </el-table-column>
                  </el-table>
                  <span slot="footer" class="dialog-footer">
                    <!-- <el-button @click.native="cancel">取 消</el-button> -->
                    <el-button @click.native="doCloseFn">取 消</el-button>
                    <el-button type="primary" @click.native="confirm">确 定</el-button>
                  </span>
                </el-dialog>
                <!--克隆 -->
                <el-table v-if="operaPrint" :data="operaPrint" @click.native="getOperaAddDiaLog" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" style="width: 100%;" border highlight-current-row max-height="300" class="th-text-center">
                  <el-table-column label="操作" width="80">
                    <template slot-scope="scope">
                      <!-- <el-button size="small" @click.native.stop="changeMoneyToZero(scope)" type="danger" class="dele">删除</el-button> -->
                      <div class="text-align-center">
                        <button v-if="scope.row.Borrow_DocNO==mouse_enter_Borrow_DocNO" size="small" @click.stop="changeMoneyToZero(scope)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="借款单" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_DocNO }}
                    </template>
                  </el-table-column>
                  <el-table-column label="总金额" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未核销金额" width="120">
                    <template slot-scope="scope">
                      {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次核销金额" width="130">
                    <template slot-scope="scope">
                      {{ scope.row.Money==0 ? '' : scope.row.Money}}
                    </template>
                  </el-table-column>
                  <el-table-column label="事由" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{ scope.row.Borrow_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <div class="clearfloat">
                  <div class="total-box">合计：<span class="Count-text">{{Count1}}</span></div>
                </div>
              </div>
            </div>
          </transition>
          <!--预算明细 新增部分-->
          <div>
            <div class="padding-size-10">
              <div class="nav">
                <span><i class="icon iconfont icon-iconfontcolor52"></i>报销明细</span>
                <!-- &#x3000;合计：<span class="Count">{{Count2}}</span>       -->
                <!-- <el-button class="add-button" size="small" @click.native="addbudget">&nbsp;添加行&nbsp;</el-button> -->
              </div>
              <table class="cusTable" border="1" width="100%">
                <tr>
                  <!-- <th>金额</th>
                  <th>费用承担部门</th>
                  <th>费用类型</th>
                  <th>预算余额</th>
                  <th>操作</th> -->
                  <th>操作</th>
                  <th>费用承担部门</th>
                  <th colspan="2">费用类型</th>
                  <th v-if="isShowValueAddTax">税金</th>
                  <th>报销金额</th>
                </tr>
                <tr v-for="(i,index) in expenseDetailList" :key="index" class="cusTable-tr">
                  <td width="10%">
                    <!-- <el-button size="small" @click.native="handleDelete(index)" type="danger" class="dele inline-block">删除</el-button> -->
                    <!-- <el-button size="small" @click.native="addbudget" type="danger" class="dele inline-block">增加</el-button> -->
                    <div class="oper-btn-wrapper">
                      <button size="small" @click="handleDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      <button size="small" @click="addbudget" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                    </div>
                  </td>
                  <td width="20%">
                    <el-select class="formVal full-box" v-model="i.YBL_Department" @visible-change="changeSelect(index,i.YBL_Department,$event)">
                      <!-- v-model => 费用承担部门 -->
                      <el-option v-for="(item,index) in bears" :value="item.CODE" :key="index" :label="item.FULLNAME">
                      </el-option>
                    </el-select>
                  </td>
                  <td width="35%">
                    <el-select class="formVal full-box" @change="ChangeMoney(index)" v-model="i.ExpenseLine_YBL">
                      <!-- v-model => 费用类型 -->
                      <el-option v-for="(item,index) in i.costTypes" :value="item.ID" :key="item.ID" :label="item.BudgetItem_Name">
                      </el-option>
                    </el-select>
                  </td>
                  <td width="15%" class="font-budgetBalance">
                    <span class="budgetBalance">余额：{{i.balance?i.balance:0}}</span><!-- 预算金额 -->
                  </td>
                  <td v-if="isShowValueAddTax">
                    <!-- 税金 -->
                    <el-input type="text" @blur="doToFixed(i,'ExpenseLine_Tax')" @keyup.native="onlyNumObjFn(i,'ExpenseLine_Tax')" v-model="i.ExpenseLine_Tax" class="formval-money full-box" placeholder="请输入金额"></el-input>
                  </td>
                  <td>
                    <el-input type="text" @blur="doToFixed(i,'ExpenseLine_RequestMoney')" @keyup.native="onlyNumObjFn(i,'ExpenseLine_RequestMoney')" @keydown.enter.native="addbudget" v-model="i.ExpenseLine_RequestMoney" class="formval-money full-box" placeholder="请输入金额"></el-input>
                  </td>
                  <!-- <td>
                    <el-button size="small" @click.native="handleDelete(index)" type="danger" class="dele">删除</el-button>
                  </td> -->
                </tr>
              </table>
              <div class="clearfloat">
                <div class="total-box">合计：<span class="Count-text">{{Count2}}</span></div>
              </div>              
            </div>
          </div>
          <!--往来明细-->
          <transition name="fade">
            <div v-if="isShowExpense" class="padding-size-10">
              <div>
                <div class="nav">
                  <span><i class="icon iconfont icon-iconfontcolor52"></i>往来明细</span>
                  <!-- &#x3000;合计：<span class="Count">{{Count3}}</span>		 -->
                  <!-- <el-button class="add-button"  size="small" @click.native="addTrade">&nbsp;添加行&nbsp;</el-button> -->
                </div>
                <table class="cusTable" border="1" width="100%">
                  <tr>
                    <th>操作</th>
                    <th>挂账科目</th>
                    <th>挂账单位</th>
                    <th>金额</th>
                  </tr>
                  <tr v-for="(a,index) in tradeLineList" :key="index" class="cusTable-tr">
                    <td width="10%">
                      <!-- <el-button size="small" @click="handleDelete2(index)" type="danger" class="dele inline-block">删除</el-button>
                      <el-button size="small" @click="addTrade" type="danger" class="dele inline-block">增加</el-button> -->
                      <div class="oper-btn-wrapper">
                        <button size="small" @click="handleDelete2(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                        <button size="small" @click="addTrade" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                      </div>
                    </td>
                    <td>
                      <el-select class="formVal full-box" v-model="a.AccountItem"><!--挂账科目-->
                        <el-option v-for="(b,index) in accountItem.Base_AccountItem" :value="b.AccountItem_Code" :key="b.AccountItem_Code" :label="b.AccountItem_Name">
                        </el-option>
                      </el-select>
                    </td>
                    <td>
                      <el-select class="formVal full-box" v-model="a.AssistItem"><!--挂账单位-->
                        <el-option v-for="(b,index) in accountItem.Base_AssistItem" :value="b.AI_Code" :key="b.AI_Code" :label="b.AI_Name">
                        </el-option>
                      </el-select>
                    </td>		
                    <td>
                      <el-input type="text" :autofocus="true" @blur="doToFixed(a,'money')" class="formval-money full-box" v-model="a.money" @keyup.native="onlyNumObjFn(a,'money')" @keydown.enter.native="addTrade" placeholder="请输入金额"></el-input>
                    </td>
                  </tr>
                </table>
                <div class="clearfloat">
                  <div class="total-box">合计：<span class="Count-text">{{Count3}}</span></div>
                </div>
              </div>
            </div>
          </transition>
        </div>
      </div>
	</div>
  <!--编辑页面-->
	<div v-if="isshowEdit">
			<!-- 导航条 -->
			<div class="flex-top">
				<div>
					<i class="el-icon-arrow-left back" @click="editToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						报销单 </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">{{Type===0?'新增':Type===1?'修改':Type===2?'查看':Type===3?'待审核':''}}</el-tag>
					</small> -->
				</div>
				<!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <el-button-group>
              <el-button size="small" @click="openUploadDialog" :disabled="fjBtnDisabled">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>
              <el-button size="small" v-if="Type!==0" @click="Communication" :disabled="communicateButtonDisabled">
                <i class="icon iconfont icon-chat-with-doctor"></i>&nbsp;沟通
              </el-button>
              <el-button size="small" @click="checkflow" v-if="Type===2||Type===3">
                <i class="icon iconfont icon-liucheng"></i>&nbsp;流程
              </el-button>		
              <el-button size="small" v-if="Type===3" @click="rejectExpense">
                <i class="icon iconfont icon-bohui"></i>&nbsp;驳回
              </el-button>	
              <el-button size="small" @click="editSave" v-if="Type===0||Type===1" :disabled="Type===2 || Type===3">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="editSubmit" v-if="Type===0||Type===1" :disabled="Type===2 || Type===3">
                <i class="icon iconfont icon-tijiao "></i>&nbsp;提交
              </el-button>
              <el-button size="small" @click="getPrint" v-if="Type===2">
                <i class="icon iconfont icon-yy"></i>&nbsp;打印
              </el-button>
              <el-button size="small" @click="auditExpense" v-if="Type===3">
                <i class="icon iconfont icon-shenhe"></i>&nbsp;同意
              </el-button>
            </el-button-group>
					</span>
				</div>
        <!-- 沟通 -->
        <!-- <el-dialog
          :visible.sync="dialogCommunicationVisible"
          :modal-append-to-body="false"
          size="tiny">
          <ul class="Communication" ref="content">
            <li v-for="(item,index) in CommunicationContentList" :key="index">
              <el-row>
                <el-col :span="2">
                  <a href="javascript:;"><img :src="item.Img" alt="" class="round"/></a>
                </el-col>

                <el-col :span="22">              
                  <div class="message1">
                    <p class="name"><el-tag type="success">{{item.CreateByName}}</el-tag></p>       
                    <p class="content">{{item.CC_Content}}</p>
                    <p class="date"><el-tag type="primary">{{item.SysCreateDate}}</el-tag></p>
                  </div>
                </el-col>
              </el-row>
            </li>
            <li v-if="this.CommunicationContentList.length==0"><p class="not-communication"><i class="el-icon-warning"></i>未有沟通</p></li>
          </ul>
          <el-row v-if="this.communiTypes===3">
            <el-col :span="17">
              <el-select v-model="launch" multiple filterable="" allow-create placeholder="请选择沟通对象" style="width:80%;">
                <el-option v-for="(item,index) in LaunchList" :key="index" :label="item.RealName" :value="item.Id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <el-checkbox v-model="launchChecked" @change="launchChange(launchChecked)">允许提交者编辑单据</el-checkbox>
            </el-col>
          </el-row>
          <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true">
            <el-col :span="21">
              <el-input v-model="contentInput" placeholder="请输入内容"></el-input>
            </el-col>
            <el-col :span="2">          
              <el-button style="margin-left:10px;" type="primary" @click="CommunicationDetermine">发送</el-button>
            </el-col>          
          </el-row>
        </el-dialog> -->
        <!-- 沟通改版 -->
        <el-dialog
          class="el-dialog__body-padding"
          :visible.sync="dialogCommunicationVisible"
          :modal-append-to-body="false"
          size="tiny"
          style="line-height: normal;">
          <p v-if="CommunicationContentList.length!==0" class="title">沟通内容:</p>
          <ul v-if="CommunicationContentList.length!==0" class="Communication-Two mt-15 mb-15" ref="content">
            <li v-for="(item,index) in CommunicationContentList" :key="index" :class="index!==CommunicationContentList.length-1?'mb-10':''">
              <el-row>
                <el-col :span="4" class="Communication-left">
                  <a href="javascript:;"><img :src="item.Img" alt="" class="round"/></a>
                  <p class="name" style="color: #13ce66;">{{item.CreateByName}}</p>
                </el-col>
                <el-col :span="20" style="height: 78px;">              
                  <div class="message1">      
                    <p class="content">{{item.CC_Content}}</p>
                    <p class="date"><el-tag type="primary">{{item.SysCreateDate}}</el-tag></p>
                  </div>
                </el-col>
              </el-row>
            </li>
            <!-- <li v-if="this.CommunicationContentList.length==0"><p class="not-communication"><i class="el-icon-warning"></i>未有沟通</p></li> -->
          </ul>
          <p v-if="communiTypes===3" class="title">发起沟通:</p>
          <el-row v-if="communiTypes===3" class="padding-top-15">
            <el-col :span="17">
              <el-select v-model="launch" multiple filterable="" allow-create placeholder="请选择沟通对象" style="width:80%;">
                <el-option v-for="(item,index) in LaunchList" :key="index" :label="item.RealName" :value="item.Id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <el-checkbox v-model="launchChecked" @change="launchChange(launchChecked)">允许提交者编辑单据</el-checkbox>
            </el-col>
          </el-row>
          <!-- <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true">
            <el-col :span="21">
              <el-input v-model="contentInput" placeholder="请输入内容"></el-input>
            </el-col>
            <el-col :span="2">          
              <el-button style="margin-left:10px;" type="primary" @click="CommunicationDetermine">发送</el-button>
            </el-col>          
          </el-row> -->
          <!-- <p v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" v-show="this.CommunicationContentList.length!==0" class="title padding-top-15">回复沟通:</p> -->
          <div v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" v-show="this.CommunicationContentList.length!==0">
            <p v-if="this.communiTypes!==3" class="title padding-top-15">回复沟通:</p>
          </div>
          <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" class="padding-top-15">
            <el-col :span="24">
              <el-input v-model="contentInput" type="textarea" :rows="3" placeholder="请输入内容"></el-input>
            </el-col>     
          </el-row>
          <el-row v-if="(this.communiTypes!==0 && this.communiTypes!==2) || this.isshowLauch==true" class="padding-top-15">
            <el-col :span="24">          
              <el-button style="float: right;" type="primary" @click="CommunicationDetermine">发送</el-button>
            </el-col>          
          </el-row>
        </el-dialog>        
        <!--流程图-->
				<el-dialog title="流程执行情况" :visible.sync="checkflowVisible" :modal-append-to-body="false" align="center">
					<el-table :data="docView" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
						<el-table-column property="PlanUser" label="操作人"></el-table-column>
						<el-table-column property="StepName" label="步骤名称"></el-table-column>
						<el-table-column property="OpDate" label="时间"></el-table-column>
						<el-table-column property="OpRemark" label="备注"></el-table-column>
					</el-table>
				</el-dialog>

        <!--
				打印窗口
        -->
        <el-dialog :visible.sync="dialogPrintVisible" :modal-append-to-body="false">
          <div class="printBox cover">
            <el-button size="small" class="center" @click.native="printPdf()">&#12288;打印&#12288;</el-button>
            <div id="form1">
              <table width="100%" border="0" v-loading="PrintLoading" element-loading-text="正在加载中">
              <caption>
                <h3 id="Doc">{{printsData.ER_Tite || ''}}</h3>
              </caption>
              <thead>
                <tr>
                  <td style="padding:15px 10px;line-height:30px;">
                    <div id="CompanyName" style="float:left">{{printsData.CompanyName || ''}}</div>
                    <div id="Current" style="float:right">打印日期：{{printsData.Current || ''}}</div>
                  </td>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">单号</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocNo : '' }}</td>
                            <td class="tbTitle">申请人</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RequestEmpName : ''}}</td>
                            <td class="tbTitle">申请部门</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RequestDeptName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单据日期</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocDateStr : ''}}</td>
                            <td class="tbTitle">业务类型</td>
                            <td class="Tabletd">{{printsData.entity.BusinessType==2?`对私`:`对公`}}</td>
                            <td class="tbTitle">供应商</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.SupplierName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">申请金额</td>
                            <!-- <td class="Tabletd">{{printsData.entity && printsData.entity.TotalRequestMoney ? printsData.entity.TotalRequestMoney.toFixed(2) : '0.00'}}</td> -->
                            <td class="Tabletd">{{printsData.entity && printsData.entity.TotalRequestMoney ? Math.round(printsData.entity.TotalRequestMoney*100)/100 : '0.00'}}</td>
                            <td class="tbTitle">本次付款金额</td>
                            <!-- <td class="Tabletd">{{printsData.entity && printsData.entity.TotalLeaveMoney ? printsData.entity.TotalLeaveMoney.toFixed(2) : '0.00'}}</td> -->
                            <td class="Tabletd">{{printsData.entity && printsData.entity.TotalLeaveMoney ? Math.round(printsData.entity.TotalLeaveMoney*100)/100 : '0.00'}}</td>
                            <td class="tbTitle">开户银行</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RcvBank : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">银行账号</td>
                            <td class="Tabletd">
                              {{printsData.entity ? printsData.entity.RcvBankAccount:''}}
                            </td>
                            <td class="tbTitle">业务描述</td>
                            <td colspan="3" class="Tabletd">
                              {{printsData.entity ? printsData.entity.Title : ''}}
                            </td>                 
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr v-if="printsData.entity && printsData.entity.ExpenseBorrowLineSet && printsData.entity.ExpenseBorrowLineSet.length>0">
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr v-if="printsData.entity && printsData.entity.ExpenseBorrowLineSet && printsData.entity.ExpenseBorrowLineSet.length>0">                   
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>借款单号</td>
                            <td>借款金额</td>
                            <td>未核销金额</td>
                            <td>本次核销金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.ExpenseBorrowLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.BorrowDoc ? p.BorrowDoc : ''}}</td>
                            <!-- <td>{{p && p.TotalBorrowMoney ? p.TotalBorrowMoney.toFixed(2) : ''}}</td>
                            <td>{{p && p.CurrentLeaveMoney ? p.CurrentLeaveMoney.toFixed(2) :''}}</td>
                            <td>{{p && p.WriteOffMoney ? p.WriteOffMoney.toFixed(2) :''}}</td> -->
                            <td>{{p && p.TotalBorrowMoney ? Math.round(p.TotalBorrowMoney*100)/100 : ''}}</td>
                            <td>{{p && p.CurrentLeaveMoney ? Math.round(p.CurrentLeaveMoney*100)/100 :''}}</td>
                            <td>{{p && p.WriteOffMoney ? Math.round(p.WriteOffMoney*100)/100 :''}}</td>
                          </tr>
                          <tr>
                            <td colspan="4">合计</td>
                            <!-- <td>{{printsData.entity && printsData.entity.ExpenseBorrowLineSetMoney ? printsData.entity.ExpenseBorrowLineSetMoney.toFixed(2):'0.00'}}</td> -->
                            <td>{{printsData.entity && printsData.entity.ExpenseBorrowLineSetMoney ? Math.round(printsData.entity.ExpenseBorrowLineSetMoney*100)/100:'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>预算树</td>
                            <td>预算组织</td>
                            <td>预算科目</td>
                            <td>借款金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.ExpenseLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.YBDEntity.YearBudgetName ? p.YBDEntity.YearBudgetName : ''}}</td>
                            <td>{{p.YBDEntity.DepartmentName ? p.YBDEntity.DepartmentName : ''}}</td>
                            <td>{{p.YBDEntity.BudgetItemName ? p.YBDEntity.BudgetItemName : ''}}</td>
                            <!-- <td>{{p && p.RequestMoney ? p.RequestMoney.toFixed(2) : ''}}</td> -->
                            <td>{{p && p.RequestMoney ? Math.round(p.RequestMoney*100)/100 : ''}}</td>
                          </tr>
                          <tr>
                            <td colspan="4">合计</td>
                            <!-- <td>{{printsData.entity && printsData.entity.ExpenseLineSetMoney ? printsData.entity.ExpenseLineSetMoney.toFixed(2):'0.00'}}</td>-->
                            <td>{{printsData.entity && printsData.entity.ExpenseLineSetMoney ? Math.round(printsData.entity.ExpenseLineSetMoney*100)/100:'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr v-if="printsData.entity && printsData.entity.ExpenseTradeLineSet && printsData.entity.ExpenseTradeLineSet.length>0"><td style="line-height:30px;">&nbsp;</td></tr>
                <tr v-if="printsData.entity && printsData.entity.ExpenseTradeLineSet && printsData.entity.ExpenseTradeLineSet.length>0">     
                 <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>挂账科目</td>
                            <td>往来单位</td>
                            <td>挂账金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.ExpenseTradeLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.AccountItemName ? p.AccountItemName : ''}}</td>
                            <td>{{p.AssistItemName ? p.AssistItemName : ''}}</td>
                            <!-- <td>{{p && p.TradeMoney ? p.TradeMoney.toFixed(2) : ''}}</td> -->
                            <td>{{p && p.TradeMoney ? Math.round(p.TradeMoney*100)/100 : ''}}</td>
                          </tr>
                          <tr>
                            <td colspan="3">合计</td>
                            <!-- <td>{{printsData.entity && printsData.entity.ExpenseTradeLineSetMoney ? printsData.entity.ExpenseTradeLineSetMoney.toFixed(2):'0.00'}}</td>-->
                            <td>{{printsData.entity && printsData.entity.ExpenseTradeLineSetMoney ? Math.round(printsData.entity.ExpenseTradeLineSetMoney*100)/100:'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>处理人</td>
                            <td>处理结果</td>
                            <td>备注</td>
                            <td>处理日期</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.Chart" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.PlanUser ? p.PlanUser : ''}}</td>
                            <td>{{p.StepName ? p.StepName : ''}}</td>
                            <td>{{p.OpRemark ? p.OpRemark : ''}}</td>
                            <td>{{p.OpDate ? p.OpDate : ''}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <!--审批流-->
                  <td>
                    <div id="Chart" class="table-c"></div>
                  </td>
                </tr>
              </tbody>
            </table>
            </div>
          </div>
        </el-dialog>
			</div>
			<!-- 中部 -->
      <div class="flex-content">
        <main class="borrow main">
          <div class="main-left">
            <div v-if="Type == 1 || Type == 2 || Type == 3">
              <h3>单号:</h3>
              <strong>{{expenseDetail.Expense_DocNO}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" placeholder="选择日期" v-model="expense_DocDate" :disabled="Type===2 || Type===3">
                </el-date-picker>
              </div>
            </div>
            <div>
              <h3>本次付款金额</h3>
              <!-- <strong>
                <i class="icon iconfont icon-yue"></i>
              </strong>
              <el-input type="number" style="width:100px;" v-model.number="comPay"></el-input> 
              <span class="comPay-input">{{comPay}}</span> --> 
              <div class="comPay-wrapper">
                <strong class="comPay-icon">
                  <i class="icon iconfont icon-yue"></i>
                </strong>
                <!-- <el-input type="number" style="width:100px;" v-model.number="comPay"></el-input> -->
                <div class="comPay-text">
                  <span class="comPay-input">{{comPay}}</span>
                </div>
              </div>
            </div>
          </div>
          <div class="main-right">
            <div class="left-form">
              <el-row>
                <el-col :span="12">
                  <span class="ele-text">收款对方</span>
                  <el-radio-group v-model="supplierRadio" class="ele-form" :disabled="Type===2 || Type===3" @change="checkRadio(supplierRadio)">
                    <el-radio :label="2">{{name}}</el-radio>								
                    <el-radio :label="1" class="supplier-wrapper">
                      <u @click="showDropDial" v-if="Type!==2 && Type!==3" class="text-ellipsis">{{supplierSelect!=""&&supplierRadio==1?SupplyCodeToNameFn:"其他"}}</u>
                      <u v-if="Type===2 || Type===3" class="text-ellipsis">{{supplierSelect!=""&&supplierRadio==1?SupplyCodeToNameFn:"其他"}}</u>
                      <!-- <el-popover ref="popover4" placement="bottom" width="320" trigger="click">
                        <div style="height:305px;">
                          <el-select v-model="supplierSelect" class="ele-form" :class="{ 'show-drop': supplierRadio==1 }" @change="choiceSupplie(supplierSelect)" filterable placeholder="请选择供应商">
                            <el-option v-for="(item,index) in selecSupplier" :key="index" :value='item.Code' :label="item.Name">
                            </el-option>
                          </el-select>
                        </div>
                      </el-popover>                
                      <el-button ref="supplierRadioTwo" class="btn-no-border" v-popover:popover4></el-button>  -->
                      <div v-if="!(Type===2||Type===3)" v-show="isShowSupplierSelect" class="supplier-dialog-cover" @click="supplierRadio=2"></div>
                      <div v-if="!(Type===2||Type===3)" v-show="isShowSupplierSelect" class="supplier-dialog-wrapper">
                        <div class="supplier-dialog-box">
                          <div>
                            <el-select v-model="supplierSelect" class="ele-form" :class="{ 'show-drop': supplierRadio==1 }" @change="choiceSupplie(supplierSelect)" filterable placeholder="请选择供应商">
                              <el-option v-for="(item,index) in selecSupplier" :key="index" :value='item.Code' :label="item.Name">
                              </el-option>
                            </el-select>
                          </div>
                          <i class="kx-arrow kx-arrow-up">
                            <em></em>
                            <span></span>
                          </i>
                        </div>
                      </div>
                    </el-radio>
                  </el-radio-group>
                </el-col>
                <el-col :span="12" style="position:relative">
                  <span class="ele-text">银行账号</span>
                  <span v-if="rcvBank" type="primary" class="bankNum">
                    {{rcvBankAccount}}
                  </span>
                </el-col>
                <el-col :span="12">
                  <span class="text-money">申请金额(含税)元</span>
                  <input type="text" @keyup="onlyNumObjFn(expenseDetail,'Expense_TotalRequestMoney')" @blur="doToFixed(expenseDetail,'Expense_TotalRequestMoney')" v-model="expenseDetail.Expense_TotalRequestMoney" class='applied' :disabled="Type===2 || Type===3">               
                </el-col>
                <el-col :span="12">
                  <span class="ele-text">开户银行</span>
                  <el-select v-model="rcvBank" class="ele-form" :disabled="Type===2 || Type===3" @change="bankChange(rcvBank)">
                    <el-option v-for="(items,index) in bankInfo" :key="index" :value="items.Code" :label="items.Bank" >
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="24" class="expense-title-wrapper">
                  <span class="ele-text" >业务描述</span>
                  <el-input
                    type="textarea"
                    :rows="3"
                    placeholder="请输入内容"
                    v-model="expenseDetail.Expense_Title" 
                    class="textarea-title"
                    :disabled="Type===2 || Type===3">
                  </el-input>
                </el-col>
        
              </el-row>
              <!-- <div class="toLeft">           
                <span class="text-money">本次付款金额</span>
                <span class="computed">{{comPay}}</span>
              </div>   -->
              <!-- <div class="toLeft">    
                <span class="text-money">申请金额(含税)元</span>
                <input type="text" v-model="expenseDetail.Expense_TotalRequestMoney" class='applied' :disabled="Type===2 || Type===3">					
              </div> -->
            </div>
          </div>
        </main>
        <!--底部-->
        <div class="budget-two" ref="budgetBox">
          <div class="nav">
            <div class="inline-block">
              <el-switch 
              v-model="isShowOpera" 
              @change="showChange(isShowOpera)"
              :disabled="Type===2 || Type===3"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;核销借款  
            </div>
            <div class="inline-block ml20">
              <el-switch 
              v-model="isShowExpense" 
              @change="showChange(isShowExpense)"
              :disabled="Type===2 || Type===3"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;往来明细               
            </div>
            <div class="inline-block ml20" v-if="valAddTaxRight==='True'">
              <el-switch
              :disabled="Type===2||Type===3" 
              v-model="isShowValueAddTax" 
              @change="changeShowValueAddTax(isShowValueAddTax)"
              on-color="#13ce66"
              off-color="#ff4949"></el-switch>&#12288;取得增值税专用发票
            </div> 
          </div>
          <transition name="fade">
            <div v-if="isShowOpera" class="padding-size-10">
              <div class="nav">
                <span><i class="icon iconfont icon-iconfontcolor52"></i>核销借款</span>
                <!-- &#x3000;合计：<span class="Count">{{Count1}}</span>   -->
                <!-- <el-button class="add-button" size="small" @click="getOperaEditDiaLog" :disabled="Type===2 || Type===3">&nbsp;点击添加&nbsp;</el-button> -->
              </div>
              <el-dialog v-if="Type!==3" title="欠款明细" @close="doCloseFn" :visible.sync="dialogOperaVisible" :modal-append-to-body="false" align="center" size="small">
                <!-- 
                    编辑 弹窗 借款单信息
                  -->
                <el-table :data="operationTemp" border class="th-text-center"  highlight-current-row max-height="300">
                  <el-table-column label="借款单" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_DocNO }}
                  </template>
                  </el-table-column>
                  <el-table-column label="总金额" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
                  </template>
                  </el-table-column>
                  <el-table-column label="未核销金额" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                  </template>
                  </el-table-column>
                  <el-table-column label="本次核销金额" class-name="full-box" width="140">
                  <template slot-scope="scope">
                    <el-input type="text" @blur="doToFixed(scope,'row','Money')" @keyup.native="onlyNumObjFn(scope,'row','Money')" :autofocus="true" v-model="scope.row.Money" placeholder="请输入金额">
                    </el-input>
                  </template>
                  </el-table-column>
                  <el-table-column label="事由">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_Title }}
                  </template>
                  </el-table-column>
                </el-table>
                <span slot="footer" class="dialog-footer">
                  <!-- <el-button @click.native="cancel">取 消</el-button> -->
                  <el-button @click.native="doCloseFn">取 消</el-button>
                  <el-button type="primary" @click.native="confirm">确 定</el-button>
                </span>
              </el-dialog>
              <!--克隆 -->
              <el-table v-if="operaPrint" :data="operaPrint" @click.native="getOperaEditDiaLog" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" border class="th-text-center" style="width: 100%;" highlight-current-row max-height="300">
                <el-table-column label="操作" width="80">
                  <template slot-scope="scope">
                    <!-- <el-button size="small" @click.native.stop="changeMoneyToZeroEdit(scope)" type="danger" class="dele">删除</el-button> -->
                    <div class="text-align-center" v-if="scope.row.Borrow_DocNO==mouse_enter_Borrow_DocNO">
                      <!-- //0添加  1修改 2查看  3待审核 -->
                      <button size="small" v-if="!(Type===2||Type===3)" @click.stop="changeMoneyToZeroEdit(scope)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    </div>
                  </template>                  
                </el-table-column>
                <el-table-column label="借款单" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_DocNO }}
                  </template>
                </el-table-column>  
                <el-table-column label="总金额" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
                  </template>
                </el-table-column>
                <el-table-column label="未核销金额" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                  </template>
                </el-table-column>
                <el-table-column label="本次核销金额" width="120">
                  <template slot-scope="scope">
                    {{ scope.row.Money==0 ? '' : scope.row.Money}}
                  </template>
                </el-table-column>
                <el-table-column label="事由">
                  <template slot-scope="scope">
                    {{ scope.row.Borrow_Title }}
                  </template>
                </el-table-column>
              </el-table>
              <div class="clearfloat">
                <div class="total-box">合计：<span class="Count-text">{{Count1}}</span></div>
              </div>                            
            </div>
          </transition>         
          <!-- <div class="nav">
            <span><i class="icon iconfont icon-iconfontcolor52"></i>核销借款</span>&#x3000;
            合计：<span class="Count">{{Count1}}</span>  
            <el-button class="add-button" size="small" @click="getOperaEditDiaLog" :disabled="Type===2 || Type===3">&nbsp;点击添加&nbsp;</el-button>
          </div> -->
            <!-- 
                编辑 弹窗 借款单信息
              -->
          <!-- <el-dialog title="欠款明细" :visible.sync="dialogOperaVisible" :modal-append-to-body="false" align="center" size="large">
            <el-table :data="operationTemp" border class="th-text-center"  highlight-current-row max-height="300">
              <el-table-column label="借款单" width="200">
              <template slot-scope="scope">
                {{ scope.row.Borrow_DocNO }}
              </template>
              </el-table-column>
              <el-table-column label="总金额" width="200">
              <template slot-scope="scope">
                {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
              </template>
              </el-table-column>
              <el-table-column label="未核销金额" width="200">
              <template slot-scope="scope">
                {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
              </template>
              </el-table-column>
              <el-table-column label="本次核销金额" class-name="full-box" width="200">
              <template slot-scope="scope">
                <el-input type="number" :autofocus="true" v-model.number="scope.row.Money" style="width:180px;">
                </el-input>
              </template>
              </el-table-column>
              <el-table-column label="事由">
              <template slot-scope="scope">
                {{ scope.row.Borrow_Title }}
              </template>
              </el-table-column>
            </el-table>
            <span slot="footer" class="dialog-footer">
              <el-button @click.native="cancel">取 消</el-button>
              <el-button type="primary" @click.native="confirm">确 定</el-button>
            </span>
          </el-dialog> -->
          <!--克隆 -->
          <!-- <el-table v-if="operaPrint" :data="operaPrint" border class="th-text-center" style="width: 100%;" highlight-current-row max-height="300">
            <el-table-column label="借款单" width="120">
              <template slot-scope="scope">
                {{ scope.row.Borrow_DocNO }}
              </template>
            </el-table-column>  
            <el-table-column label="总金额" width="120">
              <template slot-scope="scope">
                {{ scope.row.Borrow_TotalBorrowMoney==0 ? '' : scope.row.Borrow_TotalBorrowMoney}}
              </template>
            </el-table-column>
            <el-table-column label="未核销金额" width="120">
              <template slot-scope="scope">
                {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
              </template>
            </el-table-column>
            <el-table-column label="本次核销金额" width="120">
              <template slot-scope="scope">
                {{ scope.row.Money==0 ? '' : scope.row.Money}}
              </template>
            </el-table-column>
            <el-table-column label="事由">
              <template slot-scope="scope">
                {{ scope.row.Borrow_Title }}
              </template>
            </el-table-column>
          </el-table> -->
          <!--预算明细 编辑部分-->
          <div class="padding-size-10">
            <div class="nav">
              <span><i class="icon iconfont icon-iconfontcolor52"></i> 预算明细</span>
              <!-- &#x3000;合计：<span class="Count">{{Count2}}</span>      					 -->
              <!-- <el-button class="add-button" size="small" @click="addbudget" :disabled="Type===2 || Type===3">&nbsp;添加行&nbsp;</el-button> -->
            </div>
            <table class="cusTable" border="1" width="100%">
              <tr>
                <th>操作</th>
                <th>费用承担部门</th>
                <th colspan="2">费用类型</th>
                <!-- <th>预算余额</th> -->
                <th v-if="isShowValueAddTax">税金</th>
                <th>报销金额</th>
              </tr>
              <tr v-for="(i,index) in expenseDetailList" :key="index" class="cusTable-tr">
                <td width="80">
                  <!-- <el-button size="small" @click="handleDelete(index)" type="danger" class="dele inline-block" :disabled="Type===2 || Type===3">删除</el-button>
                  <el-button size="small" @click="addbudget" type="danger" class="dele inline-block" :disabled="Type===2 || Type===3">增加</el-button> -->
                  <!-- //0添加  1修改 2查看  3待审核 -->
                  <div class="oper-btn-wrapper">
                    <button size="small" v-if="!(Type===2||Type===3)" @click="handleDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    <button size="small" v-if="!(Type===2||Type===3)" @click="addbudget" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                  </div>
                </td>
                <td width="20%">
                  <el-select class="formVal full-box" v-model="i.YBL_Department" @visible-change="changeSelect(index,i.YBL_Department,$event)" :disabled="Type===2 || Type===3">
                    <!-- v-model => 费用承担部门 -->
                    <el-option v-for="(item,index) in bears" :value="item.CODE" :key="index" :label="item.FULLNAME">
                    </el-option>
                  </el-select>
                </td>
                <td width="35%">
                  <el-select class="formVal full-box" @change="ChangeMoney(index)" v-model="i.ExpenseLine_YBL" :disabled="Type===2 || Type===3" style="width:99%">
                    <!-- v-model => 费用类型 -->
                    <el-option v-for="(item,index) in i.costTypes" :value="item.ID" :key="item.ID" :label="item.BudgetItem_Name">
                    </el-option>
                  </el-select>
                </td>
                <td width="15%" class="font-budgetBalance">
                  <span class="budgetBalance">可用余额：{{i.balance?i.balance:0}}</span><!-- 预算金额 -->
                </td>
                <td v-if="isShowValueAddTax">
                  <!-- 税金 -->
                  <el-input type="text" @blur="doToFixed(i,'ExpenseLine_Tax')" @keyup.native="onlyNumObjFn(i,'ExpenseLine_Tax')" v-model="i.ExpenseLine_Tax" class="formval-money full-box" :disabled="Type===2 || Type===3" placeholder="请输入金额"></el-input>
                </td>
                <td>
                  <el-input type="text" @blur="doToFixed(i,'ExpenseLine_RequestMoney')" @keyup.native="onlyNumObjFn(i,'ExpenseLine_RequestMoney')" @keydown.enter.native="addbudget" v-model="i.ExpenseLine_RequestMoney" class="formval-money full-box" :disabled="Type===2 || Type===3" placeholder="请输入金额"></el-input>
                </td>
              </tr>
            </table>
            <div class="clearfloat">
              <div class="total-box">合计：<span class="Count-text">{{Count2}}</span></div>
            </div>                 
          </div>
          <!--往来明细-->
          <transition name="fade">
            <div v-if="isShowExpense" class="padding-size-10">
              <div class="nav">
                <span><i class="icon iconfont icon-iconfontcolor52"></i> 往来明细</span>
                <!-- &#x3000;合计：<span class="Count">{{Count3}}</span>   -->
                <!-- <el-button class="add-button" size="small" @click="addTrade" :disabled="Type===2 || Type===3">&nbsp;添加行&nbsp;</el-button> -->
              </div>
              <table class="cusTable" border="1">
                <tr>
                  <th>操作</th>
                  <th>挂账科目</th>
                  <th>挂账单位</th>
                  <th>金额</th>
                </tr>
                <tr v-for="(a,index) in tradeLineList"  :key="index" :disabled="Type===2 || Type===3" class="cusTable-tr">	
                    <td width="80">
                      <!-- <el-button size="small" @click="handleDelete2(index)" type="danger" class="dele inline-block" :disabled="Type===2 || Type===3">删除</el-button>
                      <el-button size="small" @click="addTrade" type="danger" class="dele inline-block" :disabled="Type===2 || Type===3">增加</el-button> -->
                      <!-- //0添加  1修改 2查看  3待审核 -->
                      <div class="oper-btn-wrapper">
                        <button size="small" v-if="!(Type===2||Type===3)" @click="handleDelete2(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                        <button size="small" v-if="!(Type===2||Type===3)" @click="addTrade" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>                      
                      </div>                   
                    </td>
                    <td>
                      <el-select class="formVal full-box" v-model="a.AccountItem" :disabled="Type===2 || Type===3"><!--挂账科目-->
                        <el-option v-for="(b,index) in accountItem.Base_AccountItem" :value="b.AccountItem_Code" :key="b.AccountItem_Code" :label="b.AccountItem_Name">
                        </el-option>
                      </el-select>
                    </td>
                    <td>
                      <el-select class="formVal full-box" v-model="a.AssistItem" :disabled="Type===2 || Type===3"><!--挂账单位-->
                        <el-option v-for="(b,index) in accountItem.Base_AssistItem" :value="b.AI_Code" :key="b.AI_Code" :label="b.AI_Name">
                        </el-option>
                      </el-select>
                    </td>							
                    <td>
                      <el-input type="text" @blur="doToFixed(a,'money')" @keyup.native="onlyNumObjFn(a,'money')" @keyup.enter.native="addTrade" class="formval-money full-box" v-model="a.money" :disabled="Type===2 || Type===3" placeholder="请输入金额"></el-input>
                    </td>
                </tr>
                <tr v-if="tradeLineList && tradeLineList.length===0"><td colspan="4">暂无数据</td></tr>
              </table>
              <div class="clearfloat">
                <div class="total-box">合计：<span class="Count-text">{{Count3}}</span></div>
              </div>              
            </div>
          </transition>
        </div>
      </div>
	</div>
  <el-dialog title="超预算提醒" :visible.sync="budgetVisible" :modal-append-to-body="false" v-loading="loading"  :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false">
          超预算<strong>{{this.budgetMoney}}</strong>元，无法提交。请选择你的操作
          <el-tabs v-model="activeName" type="card" @tab-click="handleClick" style="line-height:42px;margin-top:20px;">
            <el-tab-pane label="撤销单据" name="first">
              <el-button type="primary" size="small" @click="repealBudget">确定</el-button>
            </el-tab-pane>
            <el-tab-pane label="追加预算" name="second">
              <el-input type="textarea" v-model="abstract1" placeholder="请输入追加理由......." :rows="5"></el-input>
              <el-button type="primary" size="small" @click="Supplementarybudget">确定</el-button>
            </el-tab-pane>
            <el-tab-pane label="互调预算" name="third">
              <el-input type="textarea" v-model="abstract2" placeholder="请输入追加理由......." :rows="5"></el-input>
              <span v-for ="(item, index) in templ" :key="index">
                {{item.trr}}
                <br>
                <el-radio-group v-model="item.radio" @change="budgetChangeRadio(item.radio,index)">
                  <el-radio :label="1">不同月之间调整 </el-radio>
                  <el-radio :label="2">不同部门之间调整 </el-radio>
                  <el-radio :label="3">不同科目之间调整 </el-radio>
                </el-radio-group>
                <el-select v-model="item.value" placeholder="请选择" @change="budgetChangeSelect(index,item.value)" style="margin-left:20px;">
                  <el-option v-for="(ite,index) in budgetitem[index]" :key="index" :label="ite.Name" :value="ite.Code?ite.Code:ite.ID">
                  </el-option>
                </el-select>          
                <br>
              </span>
              <el-button type="primary" size="small" @click="Intermodulationbudget">确定</el-button>              
            </el-tab-pane>
          </el-tabs>
  </el-dialog>
  <!--附件-->
  <el-dialog title="附件" :visible.sync="dialogUploadVisible" :modal-append-to-body="false" >
        <label for="file" class="label-file" v-if="Type!=2&&Type!=3"><i class="icon iconfont icon-shangchuan">&nbsp;</i>上传</label>
        <input name="file" id="file" type="file" accept="*" @change="update" multiple/>
        <div><br></div>
        <ul ref="images" style="display:none">
          <li v-for="(item, index) in UploadList" :key="index">
            <!-- <img :src="`http://192.168.1.188:8011/${item.Attachment_Url}`" :alt="item.Attachment_FileName"> -->
            <img :src="item.Attachment_Url" :alt="item.Attachment_FileName">
          </li>
        </ul>
        <el-table :data="UploadList" header-align="center" id="test">
          <el-table-column property="ID" label="ID" width="100"></el-table-column>
          <el-table-column property="Attachment_UploadDate" label="日期" :formatter="formatUploadDate"></el-table-column>
          <el-table-column property="Attachment_FileName" label="名称" show-overflow-tooltip></el-table-column>          
          <el-table-column label="操作" max-width="100">
            <template slot-scope="scope">
              <div style="display:inline-block;">
                <el-button v-if='isShowPreview(scope.row.Attachment_FileName)' type="info" size="small" @click="preview(scope)">
                  &#12288;<i class="el-icon-search"></i>预览&#12288;
                </el-button>
              </div>
              <a class="down" :href="scope.row.Attachment_Url" :download='scope.row.Attachment_FileName'>下载</a>
              <el-button type="danger" v-if="Type!=2&&Type!=3" size="small" @click="DeleUpload(scope.$index, scope.row)">&#12288;删除&#12288;</el-button>
            </template>
          </el-table-column>
        </el-table>
  </el-dialog>
  <!--查询-->
  <el-dialog title="查询" :visible.sync="dialogSearchVisible" :modal-append-to-body="false" size="tiny">
    <el-form :model="Searchform">
      <el-form-item label="金  额 ：" :label-width="formLabelWidth">
        <el-input v-model.number.trim="Searchform.StartMoney" auto-complete="off" style="width:120px;"></el-input>
        至&nbsp;<el-input v-model.number.trim="Searchform.EndMoney" auto-complete="off" style="width:120px;"></el-input>
      </el-form-item>
      <el-form-item label="日  期 ：" :label-width="formLabelWidth">
        <el-date-picker type="date" v-model="Searchform.StartDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
        至&nbsp;<el-date-picker type="date" v-model="Searchform.EndDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
      </el-form-item>
      <el-form-item label="单  号 ：" :label-width="formLabelWidth">
        <el-input v-model="Searchform.DocNo" style="width:262px;"></el-input>
      </el-form-item>
      <el-form-item label="标  题 ：" :label-width="formLabelWidth">
        <el-input v-model="Searchform.Title" style="width:262px;"></el-input>
      </el-form-item>
      <el-form-item label="状 态 ：" :label-width="formLabelWidth">
        <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
          <el-option value="" label="全部">全部</el-option>
          <el-option
            v-for="item in StatusOptions"
            :key="item.Code"
            :label="item.Name"
            :value="item.Code">
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer cover">
      <el-button size="small" @click="Reset">重 置</el-button>
      <el-button size="small" @click="Query">确 定</el-button>
    </div>
  </el-dialog>
</section>
</template>
<script>
import moment from 'moment';
export default {
  name: "Expense",
  data() {
    return {
      viewer: null, //viewer对象
      showNum:"", //传过来的参数
      key: "",
      total: 0, //数据总数
      rows: 100, //每页显示多少条
      currentPage: 1,//当前页数
      isshowList: true, //table表单显隐
      isshowAdd: false, //新建页面显隐
      isshowEdit: false, //修改页面显隐
      ExpenseList: [], //报销单列表
      loading: true,
      isFirst: true,
      PrintLoading: true,//显示打印窗口loading
      docViewloading: false,
      UploadList: [], //附件列表数据
      StatusOptions:[],//状态列表
      /**超预算 */
      templ: [],
      abstract1: '', //追加理由
      abstract2: '', //互调预算追加理由
      Json: [],
      label: '',
      budgetitem: [],
      activeName: 'first',
      budgetMoney: 0,
      budgetVisible: false, //超预算调整
      dialogPrintVisible:false,//打印
      dialogSearchVisible:false,//查询窗口
      formLabelWidth:'120px',
      /**end */
      docView: [], //流程图列表
      docRowView: [], //流程图列表
      expense_DocDate: "", //日期
      Expense_TotalRequestMoney: "", //申请金额
      expense_Title: "", //业务描述
      username:'',
      name:'',
      budgetSelect:[],
      Expense_Detail: [],
      operationTemp: [],
      operaTempArr:[],
      printsData: {
        entity: {
          BorrowLineSet: []
        }
      }, //打印的数据
      operaPrint: [
        //克隆数组
        {
          Borrow_DocNO: "",
          Borrow_Title: "",
          Borrow_TotalBorrowMoney: 0,
          Surplus: 0,
          Money: 0
        }
      ],
      hxje: [], //核销金额参数
      Budget: [], //预算明细参数
      TradeLine: [], //往来明细参数
      ExpenseTradeLine: [], //往来
      dialogOperaVisible: false,
      supplierSelect: "",
      selecSupplier: [], //获取供应商
      supplierRadio: 0, //获取点击的名字
      bankInfo: [], //获取供应商银行信息
      rcvBank: "", //开户银行
      rcvBankAccount: "", //开户银行账号
      bears: [], //获取费用承担部门数据
      Type: 0, //0添加  1修改 2查看  3待审核
      DocNo: "",//编号
      expenseDetail: [], //报销详细信息 编辑时候用
      Msg: "", //审核提醒
      detailTemp:[],//报销明细 临时存储用
      dialogUploadVisible: false,
      expenseDetailList: [{
          ExpenseLine_RequestMoney: "", //金额
          YBL_Department: "", //费用承担部门
          ExpenseLine_YBL: "", //费用类型
          balance: "", //预算金额
          costTypes: [], // 费用数据 提交保存时候不用传
          ExpenseLine_Tax:""
        },
      ],
      Searchform: {
          StartMoney:"",
          EndMoney:"",
          StartDate:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          DocStatus:''
      },
      ExpenseLine_RequestMoney:"",
      tradeLineList: [
        {
          money: "", //金额
          AccountItem: "",
          AssistItem: ""
        }
      ],
      accountItem: [],
      borrowItem: [], //报销预算明细
      checkflowRowVisible: false, //外面的流程图
      checkflowVisible: false, //里面的流程图
      SFBudgetItem:true,
      //沟通模块
      dialogCommunicationVisible:false,//沟通窗口      
      CommunicationContentList:[],//沟通内容列表
      contentInput:'',//输入内容Model
      acquiescenceImg:'static/content/images/Header-S.png',//默认头像
      LaunchList:[],//沟通对象集合
      launch:[],//沟通对象
      launchChecked:false,//是否允许编辑
      requestEmp:'',//申请人ID
      communiTypes:0,//获取沟通状态
      isshowLauch:false,
      DocType: 301,//单据类型 报销单=301 借款单=302  还款单=303 收入确认单=304  出纳付款=401  出纳收款=402
      isShowOpera:false,//冲销明细显示隐藏
      isShowExpense:false, //往来明细显示隐藏
      isShowSupplierSelect:false,//供应商显示隐藏
      mouse_enter_Borrow_DocNO:"",//鼠标移入当前行的单号 
      isShowValueAddTax:false,//增值发票显示隐藏
      valAddTaxRight:"False",
      communicateButtonDisabled:false,//沟通按钮是否置灰
      fjBtnDisabled: true,//附件按钮置灰true
    };
  },
  watch:{
    // expenseDetailList:{
    //   deep: true,
    //   handler(val){
    //     console.log(val, "监听预算明细列表");
    //   }
    // },
    supplierRadio(curVal,oldVal){//切换收款对方时，显示下拉框 0：初始值 2：第一个值 1：第二个值
      // if(this.supplierRadio==1){
      //   console.log('我触发了它');
      //   this.doClickBtn();
      // }
      if (oldVal==2&&curVal==1) {
        this.isShowSupplierSelect=true
      }
      if (oldVal==1&&curVal==2) {
        this.isShowSupplierSelect=false
      }
    },
    supplierSelect(curVal,oldVal){//切换收款对方时，改变下拉框内容
      // if(curVal!=""&&this.supplierRadio==1){//下拉框值：--》有
      //   this.doClickBtn();
      // }
      // console.log(oldVal,"oldVal")
      // console.log(curVal,"curVal")
      if(curVal!=""&&this.supplierRadio==1){
        this.isShowSupplierSelect=false
      }

    },
    isShowOpera(curVal,oldVal){//冲销明细显示隐藏
      if(curVal&&!oldVal){//冲销明细显示
        setTimeout(()=>{
          //console.log("冲销明细显示隐藏")
          this.$refs.budgetBox.scrollTop=0;
          this.getOperaAddDiaLog();
        },100)
      }
      if(!curVal&&oldVal){//核销借款隐藏
        //清空弹框的本次核销金额
        this.operationTemp.map(item=>item.Money="");
        //隐藏时，清空核销借款表格
        this.operaPrint=[];
        //删除报销明细的核销借款内容
        // console.log("this.expenseDetailList")
        // console.log(this.expenseDetailList)
        //0添加  1修改 2查看  3有审核权限
        if (this.Type==0) {
          this.expenseDetailList=this.expenseDetailList.filter(item=>!item.DocNumber)
        }else if (this.Type==1) {
          this.expenseDetailList=this.expenseDetailList.filter(item=>{
            return this.isFalse(item.ExpenseLine_Borrow)
          })
        }
        //核销借款没有值，清空报销明细，并保留一行空值
        if (this.expenseDetailList.length==0) {
          this.expenseDetailList=[{
            ExpenseLine_RequestMoney: "", //金额
            YBL_Department: "", //费用承担部门
            ExpenseLine_YBL: "", //费用类型
            balance: "", //预算金额
            costTypes: [], // 费用数据 提交保存时候不用传
            ExpenseLine_Tax:""//税金            
          }]
        }
      }
    },
    isShowExpense(curVal,oldVal){//往来明细显示时候
      if(curVal&&!oldVal){//往来明细由关闭到打开状态
        setTimeout(()=>{
          //console.log("往来明细显示时候")
          if (this.Type!==2&&this.Type!==3) {//查看和审核状态，不下拉
            this.$refs.budgetBox.scrollTop=this.$refs.budgetBox.scrollHeight;
          }
          if (!this.showChangeFlag) {
            this.showChangeFlag=true;
            if (this.tradeLineList.length==0) {//编辑初始化，往来明细添加行
              this.addTrade();
            }
          }
          if (this.tradeLineList.length==0) {
            this.tradeLineList=[
              {
                money: "", //金额
                AccountItem: "",
                AssistItem: ""
              }
            ]            
          }          
        },100)
      }
      if (!curVal&&oldVal) {//关闭往来明细时，清空数据
        this.tradeLineList=[]
      }
    },
    isshowAdd(curVal,oldVal){//退出新增
      if (!curVal&&oldVal) {//退出时候，将冲销明细和往来明细关闭
        this.isShowOpera=false;
        this.isShowExpense=false; 
      }
    },
    isshowEdit(curVal,oldVal){//退出编辑
      if (!curVal&&oldVal) {//退出时候，将冲销明细和往来明细关闭
        this.isShowOpera=false;
        this.isShowExpense=false;
        if (this.dialogOperaVisibleFlag) {
          this.dialogOperaVisibleFlag=false
        } 
      }
      if(curVal&&!oldVal){//进入编辑
        //console.log("进入编辑")
        setTimeout(()=>{
          //console.log("2222222222222222222")
          this.$refs.budgetBox.scrollTop=0;
        },300)
      }
    }
  },
  methods:{
    changeShowValueAddTax(trueOrFalse){//切换增值发票
      if (!trueOrFalse) {//关闭取得增值税专用发票,清空表格对应的税率
        this.expenseDetailList.forEach(item=>item.ExpenseLine_Tax='')
      }
    },
    cellMouseEnterTwoFn(...arr){//主页鼠标移速单元格触发事件
      this.mouse_enter_Borrow_DocNO=arr[0].Expense_DocNO
    },
    cellMouseEnterFn(...arr){//鼠标移速单元格触发事件
      this.mouse_enter_Borrow_DocNO=arr[0].Borrow_DocNO
    },
    cellMouseLeaveFn(){
      this.mouse_enter_Borrow_DocNO=""
    },
    doCloseFn(){//取消或者关闭冲销明细弹框
      this.dialogOperaVisible=false;
      if (this.operaPrint.length==0) {
        this.isShowOpera=false
      }
      //点击取消，上面表格数组过滤
      this.operationTemp.forEach(aItem=>{
        if(this.operaPrint.findIndex(bItem=>bItem.Borrow_DocNO==aItem.Borrow_DocNO)==-1){
          aItem.Money=""
        }
      }) 
    },
    changeMoneyToZero(obj){//核销借款操作删除，改变operaPrint，并且改变弹框数据;如果表格行数为零，隐藏表格
      // console.log("this.operaPrint[obj.$index]")
      // console.log(this.operaPrint[obj.$index])
      // console.log("this.operationTemp")
      // console.log(this.operationTemp)

      //核销借款操作删除，相应的报销明细表格要做出改变
      // console.log("obj")
      // console.log(obj)
      // console.log("expenseDetailList")
      // console.log(this.expenseDetailList)
      // this.expenseDetailList=this.expenseDetailList.filter(item=>!item.DocNumber)
      let newArr1=this.expenseDetailList.filter(item=>{
        // this.isUndefined(item.DocNumber)?true:item.DocNumber!=this.operaPrint[obj.$index].Borrow_DocNO
        return this.isUndefined(item.DocNumber)?true:item.DocNumber!=this.operaPrint[obj.$index].Borrow_DocNO
      })

      this.expenseDetailList=newArr1;
      if (this.expenseDetailList.length==0) {
        this.expenseDetailList=[{
          ExpenseLine_RequestMoney: "", //金额
          YBL_Department: "", //费用承担部门
          ExpenseLine_YBL: "", //费用类型
          balance: "", //预算金额
          costTypes: [], // 费用数据 提交保存时候不用传     
          ExpenseLine_Tax:""   
        }]
      }

      this.operationTemp.map(item=>{
        if (item.Borrow_DocNO==this.operaPrint[obj.$index].Borrow_DocNO) {
          item.Money=""
        }
      })
      this.operaPrint.splice(obj.$index, 1)
    //  this.operationTemp[obj.$index].Money="";

      if (this.operaPrint.length==0) {
        this.isShowOpera=false
      }

      // console.log("this.operationTemp")
      // console.log(this.operationTemp)
      
    },
    //编辑页面的删除
    changeMoneyToZeroEdit(obj){//核销借款操作删除，改变operaPrint，并且改变弹框数据;如果表格行数为零，隐藏表格
      // console.log("this.operaPrint[obj.$index].Borrow_DocNO")
      // console.log(this.operaPrint[obj.$index].Borrow_DocNO)
      // console.log("this.operationTemp[obj.$index]")
      // console.log(this.operationTemp[obj.$index])
      //核销借款操作删除，相应的报销明细表格要做出改变
      // console.log("obj")
      // console.log(obj)
      // console.log("expenseDetailList")
      // console.log(this.expenseDetailList)
      let newArr1=this.expenseDetailList.filter(item=>{
        // this.isUndefined(item.DocNumber)?true:item.DocNumber!=this.operaPrint[obj.$index].Borrow_DocNO
        if (item.ExpenseLine_Borrow||item.DocNumber) {
          if (item.ExpenseLine_Borrow) {
            return this.isUndefined(item.ExpenseLine_Borrow)?true:item.ExpenseLine_Borrow!=this.operaPrint[obj.$index].Borrow_DocNO
          }
          if (item.DocNumber) {
            return this.isUndefined(item.DocNumber)?true:item.DocNumber!=this.operaPrint[obj.$index].Borrow_DocNO
          }
        }else{
          return true
        }
      })

      this.expenseDetailList=newArr1;
      if (this.expenseDetailList.length==0) {
        this.expenseDetailList=[{
          ExpenseLine_RequestMoney: "", //金额
          YBL_Department: "", //费用承担部门
          ExpenseLine_YBL: "", //费用类型
          balance: "", //预算金额
          costTypes: [], // 费用数据 提交保存时候不用传     
          ExpenseLine_Tax:""       
        }]
      }

      this.operationTemp.map(item=>{
        if (item.Borrow_DocNO==this.operaPrint[obj.$index].Borrow_DocNO) {
          item.Money=""
        }
      })
      this.operaPrint.splice(obj.$index, 1)

      if (this.operaPrint.length==0) {
        this.isShowOpera=false
      }
      
    },
    showChange(){//冲销明细
      
    },
    doClickBtn(){//点击"收款对方"弹窗按钮
      // this.$refs.supplierRadioTwo.$el.click();
    },
    showDropDial(){//通过改变radio的值，触发watch,从而显示下拉框
      console.log("showDropDial")
      this.isShowSupplierSelect=true;
      if(this.supplierRadio==1){
        this.supplierRadio=0;
        setTimeout(()=>{this.supplierRadio=1},1)
      }
    },
    formatDate(row, column) {
      return row.Expense_CreateDate.split("T", 1);
    },
    formatUploadDate(row, column) {
      return row.Attachment_UploadDate.split("T", 1);
    },
    changePage(page) {//当前页数
      this.currentPage = page;
      this.getList();
    },
    search(){
      this.dialogSearchVisible = true;
      this.getStatusList();
    },
    async getStatusList(){
      this.StatusOptions = await axios.get('getStatusList');
    },
    async getList() {
      this.loading = true;
      const res = await axios.get("getExpenseList", {
          page:this.currentPage,
          rows:this.rows
      })
      this.total = res.total;//总页数
      this.ExpenseList = res.rows;
      this.loading = false;
    },
    /*
     *  查询 
     */
    async Query(){
      if(new Date(this.Searchform.StartDate)>new Date(this.Searchform.EndDate)){
        // console.log(new Date(this.Searchform.StartDate),'this.Searchform.StartDate')
        // console.log(new Date(this.Searchform.EndDate),'this.Searchform.EndDate')
        this.$message({
          message: '开始日期必须小于或者等于结束时期！',
          type: 'warning',
          duration: 1200
        });
        return;
      }else if(this.Searchform.StartMoney>this.Searchform.EndMoney){
        this.$message({
          message: '开始金额必须小于或者等于结束金额！',
          type: 'warning',
          duration: 1200
        });
        return;
      }
      this.dialogSearchVisible = false;
      // console.log(this.Searchform.StartDate ? moment(this.Searchform.StartDate).format('L') : '','1');
      // console.log(this.Searchform.EndDate ? moment(this.Searchform.EndDate).add(1,"d").format('L') : '','2');
      let filterName = {
        "groupOp": "AND",
        "rules": [{
          "field": "Expense_DocNO",
          "dataType": "string",
          "op": "cn",
          "data": this.Searchform.DocNo || ''
        }, {
          "field": "Expense_Title",
          "dataType": "string",
          "op": "cn",
          "data": this.Searchform.Title || ''
        },{
          "field": "Expense_DocStatus",
          "dataType": "numeric",
          "op": "eq",
          "data": this.Searchform.DocStatus || ''
        }, {
          "field": "Expense_TotalRequestMoney",
          "dataType": "numeric",
          "op": "ge",
          "data": this.Searchform.StartMoney || ''
        }, {
          "field": "Expense_TotalRequestMoney",
          "dataType": "numeric",
          "op": "le",
          "data": this.Searchform.EndMoney || ''
        }, {
          "field": "Expense_DocDate",
          "dataType": "string",
          "op": "ge",
          "data": this.Searchform.StartDate ? moment(this.Searchform.StartDate).format('L') : ''
        }, {
          "field": "Expense_DocDate",
          "dataType": "string",
          "op": "le",
          "data": this.Searchform.EndDate ? moment(this.Searchform.EndDate).add(1,"d").format('L') : ''
        }],
        "groups": []
      }
      this.loading = true;
      const res = await axios.post("getExpenseList", { 
        filter:JSON.stringify(filterName),
        page:this.currentPage,
        rows:this.rows,
      });
      this.total = res.total;//总页数
      this.ExpenseList = res.rows;
      this.loading = false;
    },
    Reset(){
      this.Searchform = {
          StartMoney:"",
          EndMoney:"",
          StartDate:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          DocStatus:''
      }
    },
    /**
		 * 选择业务类型
		 */
    checkRadio(value) {
      //添加或编辑来控制这些数据
      // console.log(this.supplierRadio,"Type")
      // console.log(this.Type,"T")
      if(!this.isFirst) {
        //console.log("isFirst==false%%%%%%%%%%%%%%%%%")
        this.isFirst = true;
        return; 
      }
      if (this.isshowAdd===true && this.isshowEdit===false) {
        //console.log("新增页面")
        //如果是新增页面 
        this.supplierRadio = "";
        this.supplierSelect = "";
        this.rcvBank = "";
        this.rcvBankAccount = "";
        this.supplierRadio = value; //value是选取的数值 1、2
        if(this.supplierRadio===1){//如果是其他供应商 获取供应商接口并且默认第一个
          console.log("aaaaaaaaaaaaaaaaaaaaaaaaa")
          axios
          .get("getSupplier",{
            Type:this.supplierRadio,
            T: this.Type
          })
          .then(res => {
            this.selecSupplier = res;
            /* this.supplierSelect = res[0].Code; //默认第一个供应商 */
            this.Bank();
          })
        }else if (this.supplierRadio===2){
          console.log("bbbbbbbbbbbbbbbb")   
          this.Supplier(); //获取供应商
        }
        return
      }
      // 编辑页面
      if(this.isshowAdd===false && this.isshowEdit===true){
        console.log("eeeeeeeeeeeeeeeeeeee")
        console.log(typeof this.supplierRadio)
        if(this.supplierRadio===1){
          console.log("cccccccccccccc")
          axios
          .get("getSupplier",{
            Type:this.supplierRadio,
            T: this.Type
          })
          .then(res=>{
            this.selecSupplier = res;
            this.supplierSelect = '';
            this.rcvBank = '';
            this.rcvBankAccount = '';
          })
        }else if(this.supplierRadio===2){  //2
          console.log("ddddddddddddd")
          this.Supplier(); //获取个人
        }
      }
    },
    /**
		 * 从供应商选择中获取银行信息
		 */
    choiceSupplie(value) {
      this.Bank(); //获取供应商  带动开户银行和银行卡号 自动选择
    },
    //获取供应商
    Supplier() {
      axios
        .get("getSupplier", {
          Type: this.supplierRadio, //根据radio不同  1.其他 2.对私 决定不同供应商
          T: this.Type
        })
        .then(res => {
          this.selecSupplier = res;
          if(this.supplierRadio==2){//如果是个人 就默认绑定第一个供应商
            this.supplierSelect = res[0].Code; 
          }
          this.Bank(); // 接着 获取银行信息
        });
    },
    // 获取供应商银行信息
    Bank() {
      axios
        .get("getBank", {
          code: this.supplierSelect,
          type: this.supplierRadio
        })
        .then(res => {
          this.bankInfo = []; //将银行数组先清空，避免数据重复,然后再进行赋值操作
          this.bankInfo = res;
          if (!res[0]) {  
            return false;
          }
         /*  if(this.isshowAdd==true){ */
            this.rcvBankAccount = res[0].BankAccount; // 设置默认银行卡号
            this.rcvBank = res[0].Bank; //设置默认开户银行
          /* } else {
            this.bankInfo.forEach(item=>{
              if(this.rcvBank==item.Code){
                this.rcvBank = item.Bank; //设置默认开户银行
                this.rcvBankAccount = item.BankAccount;
              }
            })
          } */
        });
    },
    /**
		 * @param index [当前行数]
		 * @param id [选中的部门code]
		 */
    changeSelect(index,id,event) {
      if(event) 
      return; //如果下拉展开就不执行后面的了
      if(this.Type===0){
      // 获取费用类型方法
        this.getCostType(id).then(res => {
          this.expenseDetailList[index].costTypes = res;
          // vue中对象属性改变视图不更新问题：先清空再赋值
          let expenseDetailListTmp=this.expenseDetailList;
          this.expenseDetailList=[];
          this.expenseDetailList=expenseDetailListTmp
          
          this.expenseDetailList[index].ExpenseLine_YBL='';
          //0添加  1修改 2查看  3有审核权限
          //wuhongqing费用类型不用默认第一个值
          //this.expenseDetailList[index].ExpenseLine_YBL  = res[0] ? res[0].ID : '';   // 这个设置还是没有显示费用类新 balance 先把费用清除掉了先 
        });
        return;
      }
      if(this.Type===1 && this.SFBudgetItem){
        this.getCostType(id).then(res => {
          if(res!=null){
            this.expenseDetailList[index].costTypes = res;

            // vue中对象属性改变视图不更新问题：先清空再赋值
            let expenseDetailListTmp=this.expenseDetailList;
            this.expenseDetailList=[];
            this.expenseDetailList=expenseDetailListTmp
            
            this.expenseDetailList[index].ExpenseLine_YBL='';
            // if(this.Type!==2 && this.Type!==3) {//0添加  1修改 2查看  3有审核权限
            //   //wuhongqing费用类型不用默认第一个值
            //   //this.expenseDetailList[index].ExpenseLine_YBL = res[0] ? res[0].ID : '';   // 这个设置还是没有显示费用类新 balance 先把费用清除掉了先
            // }
          }
        });       
      }
    },
    /**
		 * @param code [部门id]
     * @param YBLID 明细ID 
		 */
    getCostType(code, YBLID) {
      console.log("+++++++++getCostType++++++++++++++")
      let Borrow_DocDate = moment(this.Borrow_DocDate).format('YYYY-MM');
      if(this.SFBudgetItem){
      //费用类型
        var params = {
          id: code,
          BudgetType: 1, //1是报销单
          period: Borrow_DocDate,
          type: this.Type, //1是新增或修改 2审核查看
          YBLID: YBLID
          //1是新增或修改 2审核查看
        };
        return axios.post("getBudgetItem", params);
      }
      return null;
    },

    ChangeMoney(index) {
      //费用类型绑定 与 预算金额
      const ExpenseLine_YBL = this.expenseDetailList[index].ExpenseLine_YBL; //费用类型ID
      this.expenseDetailList[index].costTypes.map(item =>
          ExpenseLine_YBL == item.ID ? (this.expenseDetailList[index].balance = item.YBL_ThisLeaved) : ""
      );
    },
    // 获取费用承担部门数据
    bear() {
      axios.get("getDept").then(res => {
        return (this.bears = res);
      });
    },
    /**
     * 新增页面显示
     */
    handleAdd() {
      this.isshowAdd = true; //新建页面显示
      this.isshowList = false; //列表页面隐藏
      this.isshowEdit = false; //编辑页面隐藏
      this.isShowValueAddTax = false; //增值税
      this.expense_DocDate = new Date();
      this.supplierRadio = 2;
      /**
			 * 打开新增页面时顺便清空下数据
			 */
      this.operaTempArr = [];
      /* this.comPay = 0; */
      this.Expense_TotalRequestMoney = "";//申请金额
      this.expenseDetail.Expense_TotalRequestMoney = 0;
      this.expense_Title = '';//业务描述
      this.operaPrint = []; //核算借款
      this.tradeLineList = [];
      this.DocNo = '';
      this.getTradeList(); //获得挂账单位挂账科目列表
      this.expenseDetailList = [
        {
          ExpenseLine_RequestMoney: "",
          ExpenseLine_YBL: "",
          YBL_Department: "",
          balance: "",
          ExpenseLine_Tax:""
        }
      ];
      
      this.operationTemp.length = 0;
      //Type: 0, //0添加  1修改 2查看  3待审核
      this.Type = 0;
      axios.get("getBorrowEmployee",{
        SupplierCode: ''
      }).then(res=>{
        this.name = res[0].Name;      
      }).catch(err=>{
        console.log(err);                        
      })
      // 显示新增页面 获取 供应商信息
      this.Supplier();
      // 判断取得增值税发票
      this.getValueAddTaxRight();
    },
    //获取系统参数信息--判断取得增值税发票
    async getValueAddTaxRight(){ this.valAddTaxRight = await axios.get("getHasTaxByCompany") },
    // 添加行
    handleCurrentChange(val) {
      this.currentRow = val++;
    },
    /**
		 * 预算明细添加行
		 */
    addbudget() {
      this.expenseDetailList.push({
        isAdd:true,
        ExpenseLine_RequestMoney: "",
        YBL_Department: "",
        ExpenseLine_YBL: "",
        balance: "",
        costTypes: [], // 费用类型 数据
        ExpenseLine_Tax:""
      });
    },
    /*
		  往来明细添加行
		 */
    addTrade() {
      this.tradeLineList.push({
        money: "",
        AccountItem: "",
        AssistItem: ""
      });
    },
    //获取往来明细接口
    async getTradeList(){ this.accountItem = await axios.get("accountItem") },
    /** 
     * 编辑页 
     */
    // handleEdit(index, row) {
    handleEdit(...rest) {
      let row=rest[0];
      //wu退出新建页面，将收款对方恢复初始值
      this.supplierRadio=2;
      this.supplierSelect="";

      //console.log("++++++handleEdit编辑页++++++++++,isFirst="+this.isFirst)
      
      //wu退出新建页面，将收款对方恢复初始值
      this.supplierRadio=2;
      this.supplierSelect="";

      this.isFirst = false;
      this.operationTemp.length = 0;
      this.operaTempArr = [];
      if(!row){
        this.showNum = this.$route.query.showNum;        
        this.DocNo = this.$route.query.key; 
      }else{
        this.DocNo = row.Expense_DocNO;
      }
      this.isshowEdit = true; //编辑显示
      this.isshowList = false; //列表隐藏
      this.isshowAdd = false;
      this.isShowValueAddTax = false; //增值税 
      axios
        .get("expenseDetail", {
          key: this.DocNo
        })
        .then(resOperation => {
          // console.log("resOperation")
          // console.log(resOperation)
          this.Type = resOperation.Type; //0添加  1修改 2查看  3有审核权限
          this.expenseDetail = resOperation.entity; //报销单详细信息
          //this.fjBtnDisabled = resOperation.FJNum==0?true:false;
          if (this.Type==1) {//修改状态附件按键亮起
            this.fjBtnDisabled=false;
          }else{//查看和待审核状态，有附件数才亮起
            this.fjBtnDisabled = resOperation.FJNum==0?true:false;
          }
          // this.expenseDetail.Expense_TotalRequestMoney = Number(this.expenseDetail.Expense_TotalRequestMoney.toFixed(2));
          this.expenseDetail.Expense_TotalRequestMoney = Number(Math.round((this.expenseDetail.Expense_TotalRequestMoney)*100)/100);
          this.communiTypes = resOperation.AllowCommunication;//获得沟通对象
          this.supplierRadio = this.expenseDetail.Expense_BusinessType; //业务类型
          if(this.supplierRadio==2){//收款对方，本人
            this.isFirst=true
          }          
          this.expense_DocDate = this.expenseDetail.Expense_DocDate; //单据日期
          this.rcvBank = this.expenseDetail.Expense_RcvBank; //开户银行
          this.DocNo = this.expenseDetail.Expense_DocNO          
          this.rcvBankAccount = this.expenseDetail.Expense_RcvBankAccount; //开户银行账号
          this.isShowValueAddTax = this.expenseDetail.Expense_HasTax; //增值税
          this.operaPrint = resOperation.ER_Borrow; //核算明细打印数据
          this.username = resOperation.entity.Expense_CreateBy;
          axios.get("getBorrowEmployee",{
            SupplierCode: this.username
          }).then(res=>{
            this.name = res[0].Name; 
          }).catch(err=>{
            console.log(err);                        
          })
          this.selecSupplier = [];
          axios.get("getSupplier", {
            Type: this.supplierRadio, //根据radio不同  1.其他 2.对私 决定不同供应商
            T: this.Type
          })
          .then(res => { 
            //将供应商数组先清空，避免数据重复,然后再进行赋值操作
            //console.log(resOperation,"resOperation")
            this.selecSupplier = res;
            if(this.supplierRadio===2){//如果是个人 就默认绑定第一个供应商        
              this.supplierSelect = resOperation.entity.Expense_Supplier;
            }else{
              this.supplierSelect = resOperation.entity.Expense_Supplier;              
            }
            this.Bank(); // 接着获取银行信息 
          });
          /**
           * 先获取到借款单信息 然后不为0的才加载上去
           */
          
          const tempArr = JSON.parse(JSON.stringify(this.operaPrint)); //浅拷贝数组
          this.operaPrint = []; //先清空
          tempArr.map(item => {
            //不为0的 才push上去
            item.Borrow_TotalBorrowMoney = Number(item.Borrow_TotalBorrowMoney);
            item.Surplus = Number(item.Surplus);
            item.Money = Number(item.Money);
            if (item.Money != 0) {
              this.operaPrint.push(item);
            }
          });
          if (this.operaPrint.length!=0) {
            this.isShowOpera=true;          
          }
          this.detailTemp = resOperation.ExpenseLine;//明细列表
          this.expenseDetailList = [];
          let getCostTypePromiseAll = [];
          for (let i = 0; i < this.detailTemp.length; i++) {
            this.expenseDetailList.push({
              ...this.detailTemp[i],
              /* DocNumber: this.detailTemp[i].ExpenseLine_Borrow || "", */
              balance: 0,
              costTypes: []
            });
            getCostTypePromiseAll.push(
              this.getCostType(
                this.expenseDetailList[i].YBL_Department, // 部门id
                this.expenseDetailList[i].ExpenseLine_YBL //  明细id
              )
            );
          }
          if (resOperation.ExpenseTradeLine.length!=0) {
            this.isShowExpense=true;
          }
          this.SFBudgetItem = false;
          
          //  获取 费用类型
          Promise.all(getCostTypePromiseAll).then(resultArr => {
            // 循环
            console.log(resultArr,"resultArr")
            for (let i = 0; i < this.expenseDetailList.length; i++) {
              // 每条明细赋值费用类型数据
              this.expenseDetailList[i].costTypes = resultArr[i];
              let yes = !1;
              let m = 0; // 费用
              //循环 判断 明细里面的费用类型是不是存在 。
              resultArr[i].map(item => {
                if (item.ID == this.expenseDetailList[i].ExpenseLine_YBL) {
                  yes = !0;
                  m = item.YBL_ThisLeaved;
                }
              });
              // 不存在 就取第一个
              if (!yes) {
                this.expenseDetailList[i].ExpenseLine_YBL = resultArr[i][0].ID;
                this.expenseDetailList[i].balance = resultArr[i][0].YBL_ThisLeaved;
              } else {
                this.expenseDetailList[i].balance = m;
              }
            }
            this.SFBudgetItem = true;
          });
          //往来明显
          this.tradeLineList = [];
          let t = this.tradeLineList;
          t.forEach(e=> {
            e.AccountItem = '';
            e.AssistItem = '';
            e.money = '';
          })
          /* 
            方式1：
            for(let i =0; i< resOperation.ExpenseTradeLine.length; i++) {
            this.tradeLineList.push({
                AccountItem: resOperation.ExpenseTradeLine[i].ETL_AccountItem,
                AssistItem: resOperation.ExpenseTradeLine[i].ETL_AssistItem,
                money: resOperation.ExpenseTradeLine[i].ETL_TradeMoney
            });
            console.log(this.tradeLineList,'tradeLineLis');
          } */
          /* 
            方式2：
            const tradeLineList = resOperation.ExpenseTradeLine.map(item =>{ 
              return {
                AccountItem: item.ETL_AccountItem, 
                AssistItem: item.ETL_AssistItem, 
                money: item.ETL_TradeMoney
              }
            })
            this.tradeLineList = tradeLineList;
            console.log(this.tradeLineList,'tradeLineLis'); */
            this.tradeLineList = resOperation.ExpenseTradeLine.map(
              ({ ETL_AccountItem, ETL_AssistItem, ETL_TradeMoney }) => {
                return {
                  AccountItem: ETL_AccountItem,
                  AssistItem: ETL_AssistItem,
                  money: ETL_TradeMoney
                }
            })
            //console.log(this.tradeLineList,'tradeLineLis');
            // //判断状态获取沟通
            // if(this.communiTypes==1||this.communiTypes==2){ 
            //   this.dialogCommunicationVisible = true;
            //   this.isshowLauch = false;
            //   let all = [
            //     axios.get('CommunicationContent',{
            //       key:this.DocNo,
            //       DocType:this.DocType
            //     }),
            //     axios.get('LaunchList',{
            //       key:this.DocNo,
            //       DocType:this.DocType
            //     }),
            //   ];
            //   this.axios.all(all).then(
            //     this.axios.spread((resContent,resLaunchList)=>{
            //       this.CommunicationContentList = resContent;//获得沟通内容
            //         for(var i=0;i<this.CommunicationContentList.length;i++){
            //           if(this.CommunicationContentList[i].Img==''){//如果是空的
            //             const ac = this.acquiescenceImg;
            //             this.CommunicationContentList[i].Img = ac;//赋值默认头像
            //           }
            //         }
            //         this.requestEmp = resLaunchList.RequestEmp;//申请人ID
            //         this.LaunchList = resLaunchList.us;//获得沟通对象  
            //     })
            //   )   
            // } 
          let This=this;             
          this.getMayHaveCommunicationFn({key:This.DocNo,DocType:This.DocType,type:this.Type}).then(res=>{
            This.communicateButtonDisabled=false
            //判断状态获取沟通
            if(this.communiTypes==1||this.communiTypes==2){ 
              this.dialogCommunicationVisible = true;
              this.isshowLauch = false;
              let all = [
                axios.get('CommunicationContent',{
                  key:this.DocNo,
                  DocType:this.DocType
                }),
                axios.get('LaunchList',{
                  key:this.DocNo,
                  DocType:this.DocType
                }),
              ];
              this.axios.all(all).then(
                this.axios.spread((resContent,resLaunchList)=>{
                  this.CommunicationContentList = resContent;//获得沟通内容
                    for(var i=0;i<this.CommunicationContentList.length;i++){
                      if(this.CommunicationContentList[i].Img==''){//如果是空的
                        const ac = this.acquiescenceImg;
                        this.CommunicationContentList[i].Img = ac;//赋值默认头像
                      }
                    }
                    this.requestEmp = resLaunchList.RequestEmp;//申请人ID
                    this.LaunchList = resLaunchList.us;//获得沟通对象  
                })
              )   
            }
          }).catch((err)=>{
            This.communicateButtonDisabled=true
          })
        });
      // 判断取得增值税发票
      this.getValueAddTaxRight();
    },
    repeal(index, row) {
      this.$confirm("确认撤销该记录吗?", "提示", {
        type: "warning"
      }).then(async() => {
          const res = await axios.post("revokeExpense",{key:row.Expense_DocNO})
          this.$message({
            message: res.Message,
            type: "success"
          });
          this.getList();
      }).catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
      });
    },

    // 新建返回到列表页面
    addToBack() {
      //console.log("新建返回到列表页面")
      this.isshowAdd = false; //新建页面隐藏
      this.isshowList = true; //列表页面显示
      // //退出新建页面，将收款对方恢复初始值
      this.supplierRadio=2;
      this.supplierSelect="";     
      this.deleToback();
      this.getList();
    },
    //清空草稿的附件
    async deleToback(){
      const res = await axios.get('deleUploadBack',{
        Attachment_DocType:this.DocType,
        Attachment_DocCode:0
      })
    },
    // 编辑页面显隐
    editToBack() {
      //console.log("编辑页面显隐")
      this.isshowEdit = false; //编辑页面隐藏
      this.isshowList = true; //列表页面显示
      //退出编辑页面，将收款对方还原
      this.supplierRadio=2;
      this.supplierSelect="";      
      this.getList();
    },
    repaintDataFn(){//打开核销借款弹框，数据回填到弹框
      if (this.operaPrint.length > 0) {
        // 取原列表数据
        const tempArr = JSON.parse(JSON.stringify(this.operationTemp)); //原数据
        // 将operaPrint 中金额不为0 的 数据对应 赋值给相应的
        for (let i = 0; i < tempArr.length; i++) {
          for (let t = 0; t < this.operaPrint.length; t++) {
            if (tempArr[i].ID == this.operaPrint[t].ID) {
              //如果循环的ID相同的话
              tempArr[i].Money = this.operaPrint[t].Money; //就赋值Money
            }
          }
        }
        this.operationTemp = tempArr; //operationTemp =>最终呈现在列表上的data
      }    
    },
    getOperaAddDiaLog() {
      //--------打开核销借款弹框，数据回填到弹框--------//
      this.repaintDataFn();
      //----------------//
      if(this.operationTemp.length<=0){
        axios.post("expenseDetail",{
            key:this.DocNo //报销单编号
        }).then(res => {//直接赋值到窗口的表格上
          this.operationTemp = res.ER_Borrow;
          this.operationTemp.forEach(item => {
            // item.Borrow_TotalBorrowMoney = item.Borrow_TotalBorrowMoney.toFixed(2);
            // item.Surplus = item.Surplus.toFixed(2);
            // item.Money = item.Money === 0 ? "" : Number(item.Money.toFixed(2));
            item.Borrow_TotalBorrowMoney = Math.round(item.Borrow_TotalBorrowMoney*100)/100;
            item.Surplus = Math.round(item.Surplus*100)/100;
            item.Money = item.Money === 0 ? "" : Math.round(Number(item.Money)*100)/100;
          });
        }).catch(err => {
          console.log(err);
        });
      }
      // console.log("dialogOperaVisible1111")
      // console.log(this.dialogOperaVisible)
      //this.dialogOperaVisible = true;

      //0添加  1修改 2查看  3有审核权限
      // console.log("this.Type")
      // console.log(this.Type)
      if (this.Type==1||this.Type==2) {//修改or查看
        if (!this.dialogOperaVisibleFlag) {//修改or查看状态，第一次进来
          this.dialogOperaVisibleFlag=true;
          if (this.operaPrint.length!=0) {//修改or查看状态，第一次进来，核销借款表单有值，不打开
            this.dialogOperaVisible=false
          }else{//修改or查看状态，第一次进来，核销借款表单没有值，打开
            this.dialogOperaVisible=true
          }
        }else{
          this.dialogOperaVisible=true;
        }
      }else{//新增，或者其他状态
        this.dialogOperaVisible = true;
      }
    },
    getOperaEditDiaLog() {
      //--------打开核销借款弹框，数据回填到弹框--------//
      this.repaintDataFn();
      //----------------//
      if(this.operationTemp.length<=0){
        axios
          .post("expenseDetail",{
            key:this.DocNo //报销单编号
          })
          .then(res => {//直接赋值到窗口的表格上
            this.operationTemp = res.ER_Borrow;
            console.log(this.operationTemp,'operationTemp')
            this.operationTemp.forEach(item => {
              // item.Borrow_TotalBorrowMoney = item.Borrow_TotalBorrowMoney.toFixed(2);
              // item.Surplus = item.Surplus.toFixed(2);
              // item.Money = item.Money === 0 ? "" : item.Money.toFixed(2);
              item.Borrow_TotalBorrowMoney = Math.round(item.Borrow_TotalBorrowMoney*100)/100;
              item.Surplus = Math.round(item.Surplus*100)/100;
              item.Money = item.Money === 0 ? "" : Math.round(item.Money*100)/100;
            });
          })
          .catch(err => {
            console.log(err);
          });
      }
      ////0添加  1修改 2查看  3有审核权限
      //查看or审核权限不能打开核销借款弹框
      if (this.Type!=2&&this.Type!=3) {
        this.dialogOperaVisible = true;
      }
      
    },
    cancel() {
      this.operationTemp = this.operaTempArr;
      this.dialogOperaVisible = false;
    },
    async confirm() {
      // console.log("confirm")
    //清除空行
    if(this.expenseDetailList.length>0){
        if(this.expenseDetailList[0].ExpenseLine_RequestMoney==""
        && this.expenseDetailList[0].YBL_Department==''
        && this.expenseDetailList[0].ExpenseLine_YBL==''
        && this.expenseDetailList[0].ExpenseLine_Tax==''){//清除默认第一行
          this.expenseDetailList.splice(0,1);
        }else{
          this.expenseDetailList=this.expenseDetailList.filter((item)=>{
            if (item.ExpenseLine_RequestMoney!=""||item.YBL_Department!=""||item.ExpenseLine_YBL!=""||item.ExpenseLine_Tax!="") {
              return item
            }
          })
        }        
    }
    // console.log(this.operationTemp,"operationTemp")
    //打印到备用数组上
    //深拷贝的实现方式,转成 JSON 再转回来
    let filterOperationTemp=JSON.parse(JSON.stringify(this.operationTemp.filter(item => item.Money > 0.005)));
    this.operaPrint = filterOperationTemp

    console.log(this.operationTemp,"this.operationTemp")
    console.log(this.operaPrint,"this.operaPrint")
    if(this.operaPrint.length){
      const res = await axios.get('borrowExpenseLine',{keys:this.operaPrint.map(item => item.Borrow_DocNO).join(',')});
      console.log(res,'res111');
      let ori = [];//未改变的
      let newArr = [];//新添加
      let diff = [];// 要删除的
      
      // 取出原有的和被删的
      this.expenseDetailList.map(detail=>{
        if(detail.ExpenseLine_Borrow == "undefined"){
            detail.ExpenseLine_Borrow = ""    
        }
        if(detail.DocNumber || detail.ExpenseLine_Borrow){
            if(res.some(v=> v.BorrowLine_Doc == (detail.DocNumber || detail.ExpenseLine_Borrow))){
              ori.push(detail)
            }else{
              diff.push(detail)
            }
        }else{
            console.log("遇到个自己创建的")
            ori.push(detail)
        }
      })
      console.log("=============ori================")
      console.log("ori",ori)
      console.log("=============================")
      console.log("diff" , diff);

      // 取出新添加的
      newArr = res.filter(v => {
        console.log("v" + !ori.some( detail=> {
          console.log("detail.DocNumber || detail.ExpenseLine_Borrow",detail.DocNumber || detail.ExpenseLine_Borrow)
        if(detail.DocNumber || detail.ExpenseLine_Borrow ){
          return v.BorrowLine_Doc == (detail.DocNumber || detail.ExpenseLine_Borrow)
        }else{
          return false
        }
      }),v);
          
      return !ori.some( detail=> {
        if(detail.DocNumber || detail.ExpenseLine_Borrow){
          return v.BorrowLine_Doc == (detail.DocNumber || detail.ExpenseLine_Borrow)
        }else{
          return false
        }
      })
    })
    console.log("=============================")
    console.log("newArr" , newArr);
    // 发现新添加的才获取费用类型数据，减少了请求次数
    newArr.map(async(item, index)=>{
      const data = await this.getCostType(item.YBL_Department, item.YBLID) || [];// 费用类型数据
      const balance = data.filter(costType => costType.ID == item.YBLID)[0]//找到一条费用类型ID匹配的预算余额
      // if (!balance&&typeof(balance)!="undefined"&&balance!=0) {//如果balance不等于undefined
      if (balance!=undefined) {//如果balance不等于undefine
          ori.push({
            ExpenseLine_RequestMoney: "",
            YBL_Department: item.YBL_Department,
            ExpenseLine_YBL :item.YBLID,
            DocNumber:item.BorrowLine_Doc,
            balance: balance.YBL_ThisLeaved,      // 预算金额
            costTypes: data  // 费用类型数据
          })
      }
    })
      console.log("=============================");
      console.log("最后的结果",ori);
      this.expenseDetailList = ori;
      console.log(this.expenseDetailList,'this.expenseDetailList~~')
    } else {
       // 不存在借款单时候 还要保留自己创建的 明细和删除所有借款单的明细
        let ori = [];
        this.expenseDetailList.map(item=>{
          if(!item.DocNumber){
              ori.push(item)
          }
        })
        this.expenseDetailList = ori;
     }
     this.dialogOperaVisible = false; //关闭弹窗
     //如果operaPrint为空，关闭核销借款
     if (this.operaPrint.length==0) {
       this.isShowOpera=false;
     }
    },
    //根据核销借款单号获取对应的明细
   
    //开户银行改变的时候
    bankChange(e){ 
        //循环找出银行数组一致的对比code如果一样就赋值开户银行卡号
        this.bankInfo.forEach(item=>{
            if(e==item.Code)
              this.rcvBankAccount = item.BankAccount;
        })
    },
    //删除
    handleDel(index, row) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => {
        axios
          .post("deleExpense", {
            key: row.Expense_DocNO
          })
          .then(res => {
            if (res.Success == false) {
              this.$message({
                message: res.Message,
                type: "warning"
              });
            } else {
              this.$message({
                message: res.Message,
                type: "success"
              });
              this.getList();
            }
          })
          .catch(err => {
            console.log(err);
          });
      });
    },
    // 报销明细 删除按钮
    handleDelete(index) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => { 
        this.expenseDetailList.splice(index, 1); 
        this.$message({
          message: "已删除",
          type: "success"
        });
        if(this.expenseDetailList.length==0){
          this.expenseDetailList=[{
              ExpenseLine_RequestMoney: "", //金额
              YBL_Department: "", //费用承担部门
              ExpenseLine_YBL: "", //费用类型
              balance: "", //预算金额
              costTypes: [], // 费用数据 提交保存时候不用传
              ExpenseLine_Tax:""
            },
          ]
        }
      }); 
    },

    // 往来明细 删除按钮
    handleDelete2(index) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => {
        this.tradeLineList.splice(index, 1);
        this.$message({
          message: "已删除",
          type: "success"
        });
        if (this.tradeLineList.length==0) {
          this.isShowExpense=false;
        }
      });
    },
    /**
		 * 新增-提交
		 */
    addSubmit() {
      console.log("aaaaaaaaaaaa")
      let myArr = [];
      if (this.isShowOpera) {//如果核销借款显示
        let operaPrint = this.operaPrint;
        operaPrint.forEach(value => {
          let money = value.Money; //金额
          let docNo = value.Borrow_DocNO; //编号
          let temp = `{"je":${money},"ID":"${docNo}"}`;
          myArr.push(temp);
        });
      }
      this.hxje = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      this.hxje = `[` + this.hxje + `]`;

      let myArr2 = [];
      //过滤掉空的数据的那行
      if(this.expenseDetailList.length!=1){
        this.expenseDetailList=this.expenseDetailList.filter((item)=>{
          return (item.ExpenseLine_RequestMoney||item.ExpenseLine_YBL||item.YBL_Department||item.balance||item.ExpenseLine_Tax)
        })
      }
      let expenseDetail = this.expenseDetailList;
      expenseDetail.forEach(value => {
        let money2 = value.ExpenseLine_RequestMoney; //金额
        let ybl = value.ExpenseLine_YBL; //费用类型
        let docNumber = value.DocNumber;
        let tax=value.ExpenseLine_Tax;//税金
        let temp2 = `{"Money":${money2},"BLID":"${ybl}","BorrowDocNO":"${docNumber}","Tax":"${tax}"}`;
        myArr2.push(temp2);
      });
      this.Budget = myArr2.join(","); //逗号分割并拼接备份给json字符串传参
      this.Budget = `[` + this.Budget + `]`;
      let myArr3 = [];
      if (this.isShowExpense) {//如果报销明细显示
      //过滤掉空的数据的那行
        if (this.tradeLineList.length!=1) {
          this.tradeLineList=this.tradeLineList.filter((item)=>{
            return (item.AccountItem&&item.AssistItem&&item.AssistItem)
          })
        }
        let tradeLine = this.tradeLineList;
        tradeLine.forEach(value => {
          let money3 = value.money; //金额
          let as = value.AssistItem; //
          let ac = value.AccountItem; //
          let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
          myArr3.push(temp3);
        });
      }
      this.TradeLine = myArr3.join(","); //逗号分割并拼接备份给json字符串传参
      this.TradeLine = `[` + this.TradeLine + `]`;
      let params = {
        Expense_BusinessType: this.supplierRadio, //业务类型
        Expense_Supplier: this.supplierSelect, //供应商
        Expense_DocDate: this.expense_DocDate, //单据日期
        Expense_RcvBank: this.rcvBank, //银行开户银行
        Expense_RcvBankAccount: this.rcvBankAccount, //银行账号
        Expense_TotalRequestMoney: this.Expense_TotalRequestMoney, //申请金额
        Expense_Title: this.expense_Title, //业务描述
        //核销借款
        hxje: this.hxje,
        //预算明细
        Budget: this.Budget,
        //往来明细部分
        ExpenseTradeLine: this.TradeLine,
        Expense_DocStatus: 2, //提交
        key: this.DocNo,
        Expense_HasTax:this.isShowValueAddTax////增值税税率
      };
      console.log(params,"params")
      axios
        .post("submitExpense", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `提交成功`,
              type: "success",
              duration:1200  
            });
            this.isshowEdit = false;            
            this.isshowAdd = false;
            this.isshowList = true;
            this.getList();
          } else if(res.Success == false && res.Message === "1"){
            this.budgetVisible = true;
            this.budgetMoney = 0;
            this.Json = res.data;
            this.DocNo = res.data[0].DocNO;
            this.Json.forEach((e) => {
              this.budgetMoney += Number(e.Money);
              this.budgetMoney = this.budgetMoney;
            });
            this.getBudget();
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration:1500  
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    /**
		 * 新增-保存
		 */
    addSave() {
      let myArr = [];
      if (this.isShowOpera) {//如果核销借款显示
        let operaPrint = this.operaPrint;
        operaPrint.forEach(value => {
          let money = value.Money; //金额
          let docNo = value.Borrow_DocNO; //编号
          let temp = `{"je":${money},"ID":"${docNo}"}`;
          myArr.push(temp);
        });
      }
      this.hxje = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      this.hxje = `[` + this.hxje + `]`;  
      let myArr2 = [];
      //过滤掉有空的数据的那行
      //console.log(this.expenseDetailList)
      if (this.expenseDetailList.length!=1) {
        this.expenseDetailList=this.expenseDetailList.filter((item)=>{
          return (item.ExpenseLine_RequestMoney||item.ExpenseLine_YBL||item.YBL_Department||item.ExpenseLine_Tax)
        })
      }
      let expenseDetail = this.expenseDetailList;
      expenseDetail.forEach(value => {
        let money2 = value.ExpenseLine_RequestMoney; //金额
        let ybl = value.ExpenseLine_YBL; //费用类型
        let docNumber = value.DocNumber;
        let tax=value.ExpenseLine_Tax;//税金
        let temp2 = `{"Money":${money2},"BLID":"${ybl}","BorrowDocNO":"${docNumber}","Tax":"${tax}"}`;
        myArr2.push(temp2);
      });
      this.Budget = myArr2.join(","); //逗号分割并拼接备份给json字符串传参
      this.Budget = `[` + this.Budget + `]`;
      let myArr3 = [];
      if (this.isShowExpense) {//如果报销明细显示
        //过滤掉空的数据的那行
        if(this.tradeLineList.length!=1){
          this.tradeLineList=this.tradeLineList.filter((item)=>{
            return (item.AccountItem||item.AssistItem||item.AssistItem)
          })
        }
        let tradeLine = this.tradeLineList;
        tradeLine.forEach(value => {
          let money3 = value.money; //金额
          let as = value.AssistItem; //
          let ac = value.AccountItem; //
          let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
          myArr3.push(temp3);
        });
      }
      this.TradeLine = myArr3.join(","); //逗号分割并拼接备份给json字符串传参
      this.TradeLine = `[` + this.TradeLine + `]`;       
      //console.log(11111111)
      let params = {
        Expense_BusinessType: this.supplierRadio, //业务类型
        Expense_Supplier: this.supplierSelect, //供应商
        Expense_DocDate: this.expense_DocDate, //单据日期
        Expense_RcvBank: this.rcvBank, //银行开户银行
        Expense_RcvBankAccount: this.rcvBankAccount, //银行账号
        Expense_TotalRequestMoney: this.Expense_TotalRequestMoney, //申请金额
        Expense_Title: this.expense_Title, //业务描述
        //核销借款
        hxje: this.hxje,
        //预算明细
        Budget: this.Budget,
        //往来明细部分
        ExpenseTradeLine: this.TradeLine,
        Expense_DocStatus: 1, //保存
        key: this.DocNo,
        Expense_HasTax:this.isShowValueAddTax//增值税
      };
      axios
        .post("submitExpense", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `保存成功`,
              type: "success",
              duration: 1200
            });
            if(res.data.DocNO){
              this.DocNo = res.data.DocNO
            }
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500  
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    /**
		 * 编辑-提交
		 */
    editSubmitForm() {
      let myArr = [];
      let operaPrint = this.operaPrint;
      operaPrint.forEach(value => {
        let money = value.Money; //金额
        let docNo = value.Borrow_DocNO; //编号
        let temp = `{"je":${money},"ID":"${docNo}"}`;
        myArr.push(temp);
      });
      this.hxje = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      this.hxje = `[` + this.hxje + `]`;

      let myArr2 = [];
      //过滤掉空的数据的那行
      //console.log(this.expenseDetailList,"expenseDetailList")
      if(this.expenseDetailList.length!=1){
        this.expenseDetailList=this.expenseDetailList.filter((item)=>{
          return (item.ExpenseLine_RequestMoney||item.ExpenseLine_YBL||item.YBL_Department)
        })
      }      
      let expenseDetail = this.expenseDetailList;
      expenseDetail.forEach(value => {
        let money2 = value.ExpenseLine_RequestMoney; //金额
        let ybl = value.ExpenseLine_YBL; //费用类型
        let docNumber = value.DocNumber || value.ExpenseLine_Borrow;
        let tax=  value.ExpenseLine_Tax;//税金
        let temp2 = `{"Money":${money2},"BLID":"${ybl}","BorrowDocNO":"${docNumber}","Tax":"${tax}"}`;
        myArr2.push(temp2);
      });
      this.Budget = myArr2.join(","); //逗号分割并拼接备份给json字符串传参
      this.Budget = `[` + this.Budget + `]`;

      let myArr3 = [];
      let tradeLine = this.tradeLineList;
      // tradeLine.forEach(value => {
      //   let money3 = value.money; //金额
      //   let as = value.AssistItem; //
      //   let ac = value.AccountItem; //
      //   let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
      //   myArr3.push(temp3);
      // });
      if (this.isShowExpense) {//如果报销明细显示
      //过滤掉空的数据的那行
        if (this.tradeLineList.length!=1) {
          this.tradeLineList=this.tradeLineList.filter((item)=>{
            return (item.AccountItem||item.AssistItem||item.AssistItem)
          })
        }
        let tradeLine = this.tradeLineList;
        tradeLine.forEach(value => {
          let money3 = value.money; //金额
          let as = value.AssistItem; //
          let ac = value.AccountItem; //
          let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
          myArr3.push(temp3);
        });
      }      
      this.TradeLine = myArr3.join(","); //逗号分割并拼接备份给json字符串传参
      this.TradeLine = `[` + this.TradeLine + `]`;

      let params = {
        Expense_BusinessType: this.supplierRadio, //业务类型
        Expense_Supplier: this.supplierSelect, //供应商
        Expense_DocDate: this.expense_DocDate, //单据日期
        Expense_RcvBank: this.rcvBank, //银行开户银行
        Expense_RcvBankAccount: this.rcvBankAccount, //银行账号
        Expense_TotalRequestMoney: this.expenseDetail.Expense_TotalRequestMoney, //申请金额
        Expense_Title: this.expenseDetail.Expense_Title, //业务描述
        //核销借款
        hxje: this.hxje,
        //预算明细
        Budget: this.Budget,
        //往来明细部分
        ExpenseTradeLine: this.TradeLine,
        Expense_DocStatus: 2, //提交
        key: this.expenseDetail.Expense_DocNO,
        Expense_HasTax:this.isShowValueAddTax//增值税
      };
      console.log("editSubmitForm编辑-提交")
      axios
        .post("submitExpense", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: res.Message,
              type: "success",
              duration: 800
            });
            this.isshowEdit = false;            
            this.isshowAdd = false;
            this.isshowList = true;
            this.getList();
          } else if(res.Success == false && res.Message === "1"){
            this.budgetVisible = true;
            this.budgetMoney = 0;
            this.Json = res.data;
            this.Json.forEach((e) => {
              this.budgetMoney += Number(e.Money);
              this.budgetMoney = this.budgetMoney;
            });
            this.getBudget();
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500              
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    validationFn(){//验证报销单
      let myArr = [];
      let operaPrint = this.operaPrint;
      operaPrint.forEach(value => {
        let money = value.Money; //金额
        let docNo = value.Borrow_DocNO; //编号
        let temp = `{"je":${money},"ID":"${docNo}"}`;
        myArr.push(temp);
      });
      this.hxje = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      this.hxje = `[` + this.hxje + `]`;

      let myArr2 = [];
      //过滤掉空的数据的那行
      //console.log(this.expenseDetailList,"expenseDetailList")
      if(this.expenseDetailList.length!=1){
        this.expenseDetailList=this.expenseDetailList.filter((item)=>{
          return (item.ExpenseLine_RequestMoney||item.ExpenseLine_YBL||item.YBL_Department)
        })
      }      
      let expenseDetail = this.expenseDetailList;
      expenseDetail.forEach(value => {
        let money2 = value.ExpenseLine_RequestMoney; //金额
        let ybl = value.ExpenseLine_YBL; //费用类型
        let docNumber = value.DocNumber || value.ExpenseLine_Borrow;
        let tax=  value.ExpenseLine_Tax;//税金
        let temp2 = `{"Money":${money2},"BLID":"${ybl}","BorrowDocNO":"${docNumber}","Tax":"${tax}"}`;
        myArr2.push(temp2);
      });
      this.Budget = myArr2.join(","); //逗号分割并拼接备份给json字符串传参
      this.Budget = `[` + this.Budget + `]`;

      let myArr3 = [];
      let tradeLine = this.tradeLineList;
      // tradeLine.forEach(value => {
      //   let money3 = value.money; //金额
      //   let as = value.AssistItem; //
      //   let ac = value.AccountItem; //
      //   let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
      //   myArr3.push(temp3);
      // });
      if (this.isShowExpense) {//如果报销明细显示
      //过滤掉空的数据的那行
        if (this.tradeLineList.length!=1) {
          this.tradeLineList=this.tradeLineList.filter((item)=>{
            return (item.AccountItem||item.AssistItem||item.AssistItem)
          })
        }
        let tradeLine = this.tradeLineList;
        tradeLine.forEach(value => {
          let money3 = value.money; //金额
          let as = value.AssistItem; //
          let ac = value.AccountItem; //
          let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
          myArr3.push(temp3);
        });
      }      
      this.TradeLine = myArr3.join(","); //逗号分割并拼接备份给json字符串传参
      this.TradeLine = `[` + this.TradeLine + `]`;

      let params = {
        Expense_BusinessType: this.supplierRadio, //业务类型
        Expense_Supplier: this.supplierSelect, //供应商
        Expense_DocDate: this.expense_DocDate, //单据日期
        Expense_RcvBank: this.rcvBank, //银行开户银行
        Expense_RcvBankAccount: this.rcvBankAccount, //银行账号
        Expense_TotalRequestMoney: this.expenseDetail.Expense_TotalRequestMoney, //申请金额
        Expense_Title: this.expenseDetail.Expense_Title, //业务描述
        //核销借款
        hxje: this.hxje,
        //预算明细
        Budget: this.Budget,
        //往来明细部分
        ExpenseTradeLine: this.TradeLine,
        Expense_DocStatus: 2, //提交
        key: this.expenseDetail.Expense_DocNO,
        Expense_HasTax:this.isShowValueAddTax//增值税
      };
      let That=this;
      return new Promise(function(resolve,reject){
        axios.get("erExpenseVerification", params).then(res => {
          if (res.Success == true) {
            resolve()
          }else {
            That.$message({
              message: res.Message,
              type: "warning",
              duration: 1500              
            });
          }
        }).catch(err => {
          console.log(err);
        });         
      })
  
    },
    // editSubmit(){
    //   this.getState();
    //   if(this.communiTypes===2){ 
    //     this.isshowLauch = true;
    //     this.dialogCommunicationVisible = true;
    //   } else {
    //     this.editSubmitForm();
    //   }
    //   //提交前要先判断数据是否有误，再显示沟通弹框
    //   //this.editSubmitForm();
    // },
    editSubmit(){//改版
      this.validationFn().then(res=>{
        this.getState();
        if(this.communiTypes===2){ 
          this.isshowLauch = true;
          this.dialogCommunicationVisible = true;
        } else {
          this.editSubmitForm();
        }
        //提交前要先判断数据是否有误，再显示沟通弹框
        //this.editSubmitForm();
      })
    },
    /** 
     * 编辑-保存
     */
    editSave() {
      let myArr = [];
      let operaPrint = this.operaPrint;
      operaPrint.forEach(value => {
        let money = value.Money; //金额
        let docNo = value.Borrow_DocNO; //编号
        let temp = `{"je":${money},"ID":"${docNo}"}`;
        myArr.push(temp);
      });
      this.hxje = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      this.hxje = `[` + this.hxje + `]`;

      let myArr2 = [];
      //过滤掉有空的数据的那行
      //console.log(this.expenseDetailList)
      if (this.expenseDetailList.length!=1) {
        this.expenseDetailList=this.expenseDetailList.filter((item)=>{
          return (item.ExpenseLine_RequestMoney||item.ExpenseLine_YBL||item.YBL_Department)
        })
      }

      let expenseDetail = this.expenseDetailList;
      expenseDetail.forEach(value => {
        let money2 = value.ExpenseLine_RequestMoney; //金额
        let ybl = value.ExpenseLine_YBL; //费用类型
        let docNumber = value.DocNumber || value.ExpenseLine_Borrow ;
        let temp2 = `{"Money":${money2},"BLID":"${ybl}","BorrowDocNO":"${docNumber}"}`;
        myArr2.push(temp2);
      });
      this.Budget = myArr2.join(","); //逗号分割并拼接备份给json字符串传参
      this.Budget = `[` + this.Budget + `]`;

      let myArr3 = [];
      //let tradeLine = this.tradeLineList;
      // tradeLine.forEach(value => {
      //   let money3 = value.money; //金额
      //   let as = value.AssistItem; //
      //   let ac = value.AccountItem; //
      //   let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
      //   myArr3.push(temp3);
      // });
      if (this.isShowExpense) {//如果报销明细显示
        //过滤掉空的数据的那行
        if(this.tradeLineList.length!=1){
          this.tradeLineList=this.tradeLineList.filter((item)=>{
            return (item.AccountItem||item.AssistItem||item.AssistItem)
          })
        }
        let tradeLine = this.tradeLineList;
        tradeLine.forEach(value => {
          let money3 = value.money; //金额
          let as = value.AssistItem; //
          let ac = value.AccountItem; //
          let temp3 = `{"Money":${money3},"AS":"${as}","AC":"${ac}"}`;
          myArr3.push(temp3);
        });
      }      
      this.TradeLine = myArr3.join(","); //逗号分割并拼接备份给json字符串传参
      this.TradeLine = `[` + this.TradeLine + `]`;

      let params = {
        Expense_BusinessType: this.supplierRadio, //业务类型
        Expense_Supplier: this.supplierSelect, //供应商
        Expense_DocDate: this.expense_DocDate, //单据日期
        Expense_RcvBank: this.rcvBank, //银行开户银行
        Expense_RcvBankAccount: this.rcvBankAccount, //银行账号
        Expense_TotalRequestMoney: this.expenseDetail.Expense_TotalRequestMoney, //申请金额
        Expense_Title: this.expenseDetail.Expense_Title, //业务描述
        //核销借款
        hxje: this.hxje,
        //预算明细
        Budget: this.Budget,
        //往来明细部分
        ExpenseTradeLine: this.TradeLine,
        Expense_DocStatus: 1, //保存
        key: this.expenseDetail.Expense_DocNO,
        Invoice_TaxRatio:this.valueAddTaxRadio////增值税税率
      };
      axios
        .post("submitExpense", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: res.Message,
              type: "success",
              duration: 1200              
            });
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 1500
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    //沟通窗口打开 
    Communication(){
      this.dialogCommunicationVisible = true;
      this.isshowLauch=false;
      let all = [
          axios.get('CommunicationContent',{
            key:this.DocNo,
            DocType:this.DocType
          }),
          axios.get('LaunchList',{
            key:this.DocNo,
            DocType:this.DocType
          }),
          axios.get('getCommuniState',{
            key:this.DocNo,
            DocType:this.DocType,
            types:this.Type
          })
      ];
      this.axios.all(all).then(
        this.axios.spread((res1,res2,res3)=>{
            this.CommunicationContentList = res1;//获得沟通内容
            for(var i=0;i<this.CommunicationContentList.length;i++){
              if(this.CommunicationContentList[i].Img==''){//如果是空的
                const ac = this.acquiescenceImg;
                this.CommunicationContentList[i].Img = ac;//赋值默认头像
              }
            }
            this.requestEmp = res2.RequestEmp;//申请人ID
            this.LaunchList = res2.us;//获得沟通对象  
            this.communiTypes = res3;//获取沟通状态
        })
      )   
    },
    //允许提交者编辑单据Change事件
    launchChange(e){
      if(e){
        let bo=true;
        for(let i=0;i<this.launch.length;i++)
        { 
          if(this.launch[i]==this.requestEmp)
          bo=false;      
        }
        if(bo)this.launch.push(this.requestEmp);
      }
    },
    //确认后提交
    CommunicationDetermine(){
      if(this.isshowLauch == true)
      {
        this.$confirm('回复沟通单据将会自动提交，不可再编辑!', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
           this.Communicate();
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });           
        });
      }else{
        this.Communicate();
      }
    },
    //沟通窗口 确定按钮
    Communicate(){
      let user='';
      for(let i=0;i<this.launch.length;i++)
      { 
          user+=i!=0?',':'';
          user+=this.launch[i];
      }    
      axios.get('AddCommunicate',{
          key:this.DocNo,
          DocType:this.DocType,
          msg:this.contentInput,
          user:user,
          bj:this.launchChecked ? 1 : 0,
          type:this.communiTypes
      }).then(res=>{
          if(res.Success===true){
            if(this.isshowLauch == true)
            this.editSubmitForm();
            //获得沟通内容
            this.getContent();
            this.$message({
              message: res.Message,
              type: 'success',
              duration: 1200
            })
            this.getState();
            this.contentInput = '';
            
          }else{
            this.$message({
              message: res.Message,
              type: 'warning',
              duration: 1200
            })
          }
      }).catch(err=>{
          console.log(err);
      })      
    },
    //获取内容
    getContent(){
      axios.get('CommunicationContent',{
        key:this.DocNo,
        DocType:this.DocType
      }).then(res=>{
        this.CommunicationContentList = res;
        for(var i=0;i<this.CommunicationContentList.length;i++){
            if(this.CommunicationContentList[i].Img==''){//如果是空的
                const ac = this.acquiescenceImg;
                this.CommunicationContentList[i].Img = ac;//赋值默认头像
            }
        }    
      })
    },
    //获取type
    getState(){
      axios.get('getCommuniState',{
        key:this.DocNo,
        DocType:this.DocType,
        types:this.Type
      }).then(res=>{
        this.communiTypes = res;
        console.log(this.communiTypes,'type1');        
      }).catch(err=>{
        console.log(err);
      })
    },
    //审核提示
    checkMsg() {
      axios
        .get("checkMsg")
        .then(res => {
          this.Msg = res;
        })
        .catch(err => {
          console.log(err);
        });
    },
    //驳回报销单提示
    rejectExpense(){
      axios
        .get('ExamineCommunication',{
          key:  this.DocNo,
          DocType:  this.DocType
        }).then(res => {
          if(res.Data === '1'){
            this.$confirm(res.Message, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.IsRejectExpense();
            }).catch(() => {
                this.$message({
                type: "info",
                message: "已取消"
              });
            });
          } else
            this.IsRejectExpense();
        })
        .catch(err => {
          console.log(err);
        })
    }, 
    //驳回报销 操作
    IsRejectExpense() {
      /* this.DocNo = getQueryParam("key"); */
      this.$prompt("请您输入驳回的理由", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消"
      })
        .then(({ value }) => {
          this.$message({
            type: "success",
            message: "你的驳回的理由是：" + value
          });
          axios
            .get("rejectExpense", {
              key: this.DocNo,
              type: 1, //0审核 1驳回
              Reason: value
            })
            .then(res => {
              this.$message({
                message: res,
                type: "success"
              });
              setTimeout(() => {
                this.$router.push({
                  path: "notAudit"
                });
              }, 500);
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        });
    },
    //审核报销单提示
    auditExpense(){
        axios
        .get('ExamineCommunication',{
          key:  this.DocNo,
          DocType:  this.DocType
        }).then(res => {
          if(res.Data === '1'){
            this.$confirm(res.Message, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.ToExamineBorrow();
            }).catch(() => {
                this.$message({
                type: "info",
                message: "已取消"
              });
            });
          } else if(res.Data === '2') {
            this.$message({
              type: "warning",
              message: res.Message,
              duration:1500 
            });
          }else
            this.ToExamineBorrow();
        })
        .catch(err => {
          console.log(err);
        })
    }, 
    //审核报销操作
    ToExamineBorrow() {
      this.checkMsg();//审核提示
      this.$confirm(this.Msg, {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
            axios
            .get("auditExpense", {
              key:  this.DocNo,
              type: 0 //0审核 1驳回
            })
            .then(res => {
              this.$message({
                type: "success",
                message: res
              });
              setTimeout(() => {
                this.$router.push({
                  path: "notAudit"
                });
              }, 500);
            })
            .catch(err => {
              console.log(err);
            });
      }).catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
      });
    },
    /*
     * 里面的流程图
     */
    checkflow() {
      this.checkflowVisible = true;
      this.docViewloading = true;
      axios
        .get("checkFlow", {
          DocNo: this.DocNo, //单据编号
          DocType: this.DocType //类型为报销款单
        })
        .then(res => {
          this.docView = res;
          setTimeout(() => {
            this.docViewloading = false;
          }, 800);
        })
        .catch(err => {
          console.log(err);
        });
    },
    /**
     * 外面的流程图
     */
    checkflowRow(index, rows) {
      this.checkflowRowVisible = true;
      let DocNo = rows.Expense_DocNO;
      if (this.checkflowRowVisible == true) {
        if (rows.DocStatus == "新建") {
          //如果是新建状态就直接给个提示
          this.checkflowRowVisible = false;
          this.$message({
            message: "新建状态未有流程图",
            type: "warning"
          });
        } else if (rows.DocStatus == "无效") {
          //如果是无效状态也直接给个提示
          this.checkflowRowVisible = false;
          this.$message({
            message: "未找到相对应的流程图",
            type: "warning"
          });
        } else {
          //否则直接请求拿列表数据
          this.docViewloading = true;
          axios
            .get("checkFlow", {
              DocNo: DocNo, //单据编号
              DocType: this.DocType //类型为报销单
            })
            .then(res => {
              this.docRowView = res;
              this.docViewloading = false;
            })
            .catch(err => {
              console.log(err);
            });
        }
      }
    },
    /**
     * 超预算
     */
    handleClick(tab, event) {
      this.label = tab.label;
    },
    //超预算-撤销
    repealBudget() {
      this.$confirm("确认撤销吗?", "提示", {
        type: "warning"
      }).then(() => {
        axios
          .get("revokeExpense", {
            key: this.DocNo
          })
          .then(res => {
            if(res.Success === true){
              this.$message({
                message: res.Message,
                type: "success",
                duration: 1200
              });
              this.budgetVisible = false;
              setTimeout(() => {
                this.isshowEdit = false;
                this.isshowAdd = false;
                this.isshowList = true;
                this.getList();
              }, 500); 
            }else{
              this.$message({
                message: res.Message,
                type: "warning",
                duration: 1500
              });
            }
                
          });
      });
    },
    /**
     * 追加预算
     */
    Supplementarybudget() {
      if(this.abstract1===''||this.abstract1===null||this.abstract1===undefined){
        this.$message({
          message: '追加理由不能留空',
          type: 'warning',
          duration: 1200
        });
      }else{
        let arr = [];
        let Json = this.Json;
        let docNo = Json[0].DocNO;
        Json.forEach(value => {
          let money = value.Money; //金额
          let id = value.ID; //明细ID
          let temp = `{"ID":"${id}","Money":"${money}","Type":"0","Value":"0"}`;
          arr.push(temp); 
        });
        let budget = arr.join(","); //逗号分割并拼接备份给json字符串传参
        budget = `[` + budget + `]`;
        const params = {
          DocNo: docNo, //单据编号
          DocType: this.DocType, //this.DocType类型为借款单
          Abstract: this.abstract1, //追加理由
          Json: budget
        }
        axios.get('BorrowAdjust', params).then((res) => {
          if (res == "") {
            this.$message({
              message: `系统会自动产生预算` + this.label + `申请,待预算调整审核通过后,您这张借款单会被自动提交`,
              type: 'success',
              duration:1200
            });
            this.budgetVisible = false;
            this.abstract1 = "";
            this.isshowEdit = false;
            this.isshowAdd = false;
            this.isshowList = true;
            this.getList();
          }
        }).catch((err) => {
          console.log(err)
        })
      }
    },
    /**
     * 互调预算
     */
    Intermodulationbudget() {
      if(this.abstract2===''||this.abstract2===null||this.abstract2===undefined){
        this.$message({
          message: '互调预算不能留空',
          type: 'warning',
          duration: 1200
        });
      }else{
        let arr = [];
        let Json = this.Json;
        let docNo = Json[0].DocNO;
        let budgetSelect = this.budgetSelect==undefined || this.budgetSelect==null?"":this.budgetSelect;
        console.log(budgetSelect);
        let i=0, templ=this.templ, temLength=templ.length;
        for(; i<temLength; i++){
          let radio = templ[i].radio;
          let money = Json[i].Money;
          let id = Json[i].ID;
          let budgetSelect = this.budgetSelect[i];
          let temp = `{"ID":"${id}","Money":"${money}","Type":"${radio}","Value":"${budgetSelect}"}`;
          arr.push(temp)
        } 
        let budget = arr.join(","); //逗号分割并拼接备份给json字符串传参
        budget = `[` + budget + `]`;
        const params = {
          DocNo: docNo, //单据编号
          DocType: this.DocType, //this.DocType类型为报销单
          Abstract: this.abstract2, //追加理由
          Json: budget
        }
        axios.get('BorrowAdjust', params).then((res) => {
          if (res == "") {
            this.$message({
              message: `系统会自动产生预算` + this.label + `申请,待预算调整审核通过后,您这张借款单会被自动提交`,
              type: 'success',
              duration:1500
            });
            setTimeout(()=>{
              this.budgetVisible = false;
              this.abstract2 = "";
              this.isshowEdit = false;
              this.isshowAdd = false;
              this.isshowList = true;
              this.getList();
            },1200);
          }else{
            this.$message({
              message: res,
              type: 'error',
              duration:1200
            });
          }
        }).catch((err) => {
          console.log(err)
        })
      }
    },
    /**
     * 获得自动调整
     */
    getBudget() {
      let Json = this.Json;
      this.budgetSelect;
      this.templ = []
      for (var i = 0; i < Json.length; i++) {
        let depart = Json[i].YBDEntity.DepartmentName; //部门
        let budget = Json[i].YBDEntity.BudgetItemName;
        let money = Json[i].Money;
        let str = `承担部门：${depart}	费用类型：${budget} 超支金额：${money}`
        this.templ.push({
          radio: 1,//默认1
          trr: str,
          value: ''
        });
      }
      //打开窗口时 默认将月份第一个select选项为默认绑定
      axios.get("BorrowMonth").then((res) =>{
        this.templ.forEach((e)=>{
            console.log(res,"res");
            if(res.length>0){//Month数据如果长度大于0
              e.value =  res[0].ID;//设置默认第一个 月份Month 为radio第一个选项
            }
        });
      })
      //wuhongqing触发函数，请求月份数据
      this.budgetChangeRadio(1, 0) 
    },
    /*
     * 超预算 改变Radio Change事件
     */
    budgetChangeRadio(e,index) {
      this.radio = e;
      if (e == 1) {//如果是选中第一个radio 请求月份数据
        axios.get("BorrowMonth").then((res) => {
          this.budgetitem[index] = [];
          this.budgetitem[index] = res;
          if(this.budgetitem.length>0){
            this.templ[index].value = res[0].ID ? res[0].ID : res[0].Code;
          }else{
            this.templ[index].value = ""
          }
        }).catch((err) => {
          console.log(err);
        })
      } else if (e == 2) {//如果是选中第二个radio 请求部门数据
        axios.get("BorrowDepartment", {
          Money: this.Json[index].Money,
          YBL_BudgetItem: this.Json[index].YBDEntity.BudgetItem,
          YBL_Year: this.Json[index].YBDEntity.Year,
          YBL_Month: this.Json[index].YBDEntity.Month,
          YBL_BudgetType: this.Json[index].YBDEntity.BudgetType
        }).then((res) => {
          this.budgetitem[index] = [];
          this.budgetitem[index] = res;
          if(this.budgetitem[index].length>0){
            this.templ[index].value = res[0].ID ? res[0].ID : res[0].Code;
          }else{
            this.templ[index].value = ""
          }
        }).catch((err) => {
          console.log(err);
        })
      } else if (e == 3) {//如果是选中第三个radio 请求科目数据
        axios.get("BorrowBudgetItem", { //科目
          Money: this.Json[index].Money,
          YBL_Department: this.Json[index].YBDEntity.Dept,
          YBL_YearBudget: this.Json[index].YBDEntity.YearBudget,
          YBL_Year: this.Json[index].YBDEntity.Year,
          YBL_Month: this.Json[index].YBDEntity.Month,
          YBL_BudgetType: this.Json[index].YBDEntity.BudgetType
        }).then((res) => {
          console.log(res, 'res=BudgetItem');
          this.budgetitem[index] = [];
          this.budgetitem[index] = res;
          if(this.budgetitem[index].length>0){
            this.templ[index].value = res[0].ID ? res[0].ID : res[0].Code;
          }else{
            this.templ[index].value = ""
          }   
        }).catch((err) => {
          console.log(err);
        })    
      }

    },
    budgetChangeSelect(index,e) {
      this.budgetSelect[index] = e;
    },
    //打印窗口
    async getPrint(){
      this.dialogPrintVisible = true;
      this.PrintLoading = true;
      const res = await axios.get("Print",{DocNo:this.DocNo,DocType: this.DocType});
      this.printsData = res;
      this.PrintLoading = false;      
    },
    preview(scoped) {
      console.log(this.$refs["images"]);
      if (this.viewer) {
        this.viewer.destroy();
      }
      this.viewer = new this.$Viewer(this.$refs["images"], {
        url: "src",
        toolbar: {
          zoomIn: {
            show: 4,
            size: "large"
          },
          zoomOut: {
            show: 4,
            size: "large"
          },
          prev: {
            show: 4,
            size: "large"
          },
          next: {
            show: 4,
            size: "large"
          },
          rotateLeft: {
            show: 4,
            size: "large"
          },
          rotateRight: {
            show: 4,
            size: "large"
          }
        }
      });
      console.log(this.$refs["images"].childNodes[scoped.$index])     
      this.$refs["images"].childNodes[scoped.$index].childNodes[0].click()
    },
    //打开附件列表窗口
    openUploadDialog() {
      this.dialogUploadVisible = true;
      this.getUploadList();
    },
    //附件列表
    async getUploadList() {
      const res = await axios.get('UploadList', {
        key: this.DocNo,
        type: this.DocType,
        page: 1, //一页
        rows: 5000 //显示5000条
      })
      this.UploadList = res.rows;
    },
    //删除附件
    async DeleUpload(index,row) {
      const res = await axios.get('deleUpload',{key:row.ID})
      if (res.Success) {
          this.$message({
            message: res.Message,
            type: "success"
          })
          this.getUploadList();
      }else{
          this.$message({
            message: res.Message,
            type: "error"
          })
      }
    },
    //判断是否显示预览按钮
    isShowPreview (name) {
      var fileType = ['gif','jpg','png','JPG','PNG'];
      var temp = name.substring(name.lastIndexOf('.')+1);
      if(fileType.indexOf(temp) > -1) {
        return true
      }else {
        return false
      }
    },
    //打印
    printPdf() {
      $("#form1").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //开始上传附件
    update(e) { 
      for(var i=0 ;i < e.target.files.length;i++){
        let file = e.target.files[i];
        let param = new FormData(); //创建form对象
        param.append('fileData', file); //通过append向form对象添加数据
        param.append('chunk', '0'); //添加form表单中其他数据
        param.append('key', this.DocNo); //添加form表单中其他数据
        param.append('Type', this.DocType);
        console.log(param.get('file')); //FormData私有类对象，访问不到，可以通过get判断值是否传进去
        let config = {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        }; //添加请求头
        axios.post('Upload', param, config).then(res => {
          if(res.Success){
            this.$message({
              message: `上传成功`,
              type: 'success',
              duration: 800
            });
          }else{
            this.$message({
              message: res.Message,
              type: 'warning',
              duration: 2000
            });
          }
          this.getUploadList();
        }).catch(err => {
          console.log(err)
        })
      }
    }
  },
  mounted(){
    this.checkMsg(); //审核提示      
    this.getList();//初始借款单列表
    this.bear();
    if(this.$route.query.showNum && this.$route.query.key){
      this.handleEdit();
    }
    if(this.$route.query.News){
      this.handleAdd();
    }
  },
  created(){
    this.getTradeList();
  },
  //计算属性
  computed:{
    comPay(){ //本次付款金额
      let result=((this.expenseDetail.Expense_TotalRequestMoney||this.Expense_TotalRequestMoney)*100 - this.Count1*100)/100;
      return Math.round(result*100)/100
    },
    //核算借款
    Count1(){
      let sum = 0;
      for (let i of this.operaPrint){
        sum += Number(i.Money)
      }
      // return sum.toFixed(2);
      return Math.round(sum*100)/100
    },
    //预算明细统计
    Count2(){
      let sum = 0;
      for (let i of this.expenseDetailList){
        sum += Number(i.ExpenseLine_RequestMoney)
      }
      // return sum.toFixed(2);
       return Math.round(sum*100)/100
    },
    //往来明细统计
    Count3(){
      let sum = 0;
      for (let i of this.tradeLineList) {
        sum += Number(i.money)
      }
      // return sum.toFixed(2);
       return Math.round(sum*100)/100
    },
    SupplyCodeToNameFn(){
      if (this.supplierSelect) {
        let selectObj=this.selecSupplier.find((item)=>{
          return item.Code==this.supplierSelect
        })
        if(selectObj){
          return selectObj.Name
        }else{
          return "其他"
        }
      }
    }    

  }
}
</script>
<style scoped lang="scss">
@import "../../common/css/index.css";
.toolbar h2 {
  line-height: 36px;
  margin: 0 10px 0 0;
}
.dele {
  margin: 0 auto;
  display: block;
}

.fade-enter-active,.fade-leave-active{
  transition: all 0.5s;
}
.fade-enter,.fade-leave-active{
  opacity: 0;
  transform: translateY(-400px);
}
</style>

